mirror of
https://github.com/logos-messaging/nim-chat-poc.git
synced 2026-01-28 02:33:12 +00:00
fix: pr comments
This commit is contained in:
parent
10b450c043
commit
0359d19e7b
@ -537,8 +537,8 @@ static void process_input_char(int ch) {
|
||||
}
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
case 127:
|
||||
case 8:
|
||||
case 127: // DEL
|
||||
case 8: // BS
|
||||
if (inp->pos > 0) {
|
||||
memmove(inp->buffer + inp->pos - 1, inp->buffer + inp->pos, inp->len - inp->pos + 1);
|
||||
inp->pos--;
|
||||
|
||||
@ -6,11 +6,11 @@ import chronicles
|
||||
import chronos
|
||||
import ffi
|
||||
|
||||
import ../../src/chat
|
||||
import ../../src/chat/proto_types
|
||||
import ../../src/chat/delivery/waku_client
|
||||
import ../../src/chat/identity
|
||||
import ../utils
|
||||
import src/chat
|
||||
import src/chat/proto_types
|
||||
import src/chat/delivery/waku_client
|
||||
import src/chat/identity
|
||||
import library/utils
|
||||
|
||||
logScope:
|
||||
topics = "chat ffi client"
|
||||
|
||||
@ -7,9 +7,9 @@ import chronos
|
||||
import ffi
|
||||
import stew/byteutils
|
||||
|
||||
import ../../src/chat
|
||||
import ../../src/chat/proto_types
|
||||
import ../utils
|
||||
import src/chat
|
||||
import src/chat/proto_types
|
||||
import library/utils
|
||||
|
||||
logScope:
|
||||
topics = "chat ffi conversation"
|
||||
|
||||
@ -7,10 +7,10 @@ import chronos
|
||||
import ffi
|
||||
import stew/byteutils
|
||||
|
||||
import ../../src/chat
|
||||
import ../../src/chat/crypto
|
||||
import ../../src/chat/proto_types
|
||||
import ../utils
|
||||
import src/chat
|
||||
import src/chat/crypto
|
||||
import src/chat/proto_types
|
||||
import library/utils
|
||||
|
||||
logScope:
|
||||
topics = "chat ffi identity"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import ffi
|
||||
import ../src/chat/client
|
||||
import src/chat/client
|
||||
|
||||
declareLibrary("chat")
|
||||
|
||||
|
||||
@ -9,13 +9,13 @@ import chronicles, chronos, ffi
|
||||
import stew/byteutils
|
||||
|
||||
import
|
||||
../src/chat/client,
|
||||
../src/chat/conversations,
|
||||
../src/chat/identity,
|
||||
../src/chat/delivery/waku_client,
|
||||
../src/chat/proto_types,
|
||||
./declare_lib,
|
||||
./utils
|
||||
src/chat/client,
|
||||
src/chat/conversations,
|
||||
src/chat/identity,
|
||||
src/chat/delivery/waku_client,
|
||||
src/chat/proto_types,
|
||||
library/declare_lib,
|
||||
library/utils
|
||||
|
||||
logScope:
|
||||
topics = "chat ffi"
|
||||
|
||||
@ -1,34 +1,7 @@
|
||||
## Utility functions for C-bindings
|
||||
## Provides C-string helpers and JSON event serialization
|
||||
## Provides JSON event serialization helpers
|
||||
|
||||
import std/json
|
||||
import ffi
|
||||
|
||||
# Re-export common FFI types
|
||||
export ffi
|
||||
|
||||
#################################################
|
||||
# C-String Helpers
|
||||
#################################################
|
||||
|
||||
proc toCString*(s: string): cstring =
|
||||
## Convert Nim string to C string (caller must manage memory)
|
||||
result = s.cstring
|
||||
|
||||
proc fromCString*(cs: cstring): string =
|
||||
## Convert C string to Nim string (makes a copy)
|
||||
if cs.isNil:
|
||||
result = ""
|
||||
else:
|
||||
result = $cs
|
||||
|
||||
proc toBytes*(data: ptr byte, len: csize_t): seq[byte] =
|
||||
## Convert C byte array to Nim seq[byte]
|
||||
if data.isNil or len == 0:
|
||||
result = @[]
|
||||
else:
|
||||
result = newSeq[byte](len)
|
||||
copyMem(addr result[0], data, len)
|
||||
|
||||
#################################################
|
||||
# JSON Event Types
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user