Skip to content

fix(examples): pass string into editor, not buffer#339

Open
joepie91 wants to merge 1 commit intoromgrk:masterfrom
joepie91:patch-2
Open

fix(examples): pass string into editor, not buffer#339
joepie91 wants to merge 1 commit intoromgrk:masterfrom
joepie91:patch-2

Conversation

@joepie91
Copy link

@joepie91 joepie91 commented Feb 4, 2023

Code originally attempts to pass a Buffer into the editor contents, which fails with the following error:

TypeError: Cannot convert value "[object Uint8Array]" to type gchararray
    at GtkSourceBuffer.text (/home/sven/projects/_3rdparty/node-gtk/lib/bootstrap.js:194:21)
    at loadFile (/home/sven/projects/_3rdparty/node-gtk/examples/editor.js:83:21)
    at Object.<anonymous> (/home/sven/projects/_3rdparty/node-gtk/examples/editor.js:213:1)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

Seems that the editor contents are actually expected to be a string, so this decodes it as a (UTF8) string instead. Quick test seemed to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant