EC_EDITLINE_CURLINE(3)

πŸ“¦
version 0.11.7 Β· 5 versions
, in fedora 44

πŸ’– EC_EDITLINE_CURLINE πŸ’–

okay bestie, so this one is from the Libecoli Programmer's Manual and it's literally just about grabbing the line you're currently editing. one function, tiny page, big slay. ✨


πŸŽ€ NAME πŸŽ€

ec_editline_curline β€” get the current edited line, periodt. πŸ’…


✨ SYNOPSIS ✨

#include <ecoli/editline.h>

char * ec_editline_curline(
    const struct ec_editline   *editline,           /* The pointer to the ec_editline structure. */
    /*
     * If true, remove all characters starting from cursor (included).
     */
    bool                        trim_after_cursor
);

so you pull in <ecoli/editline.h> first, obviously, and then it's giving two args, no cap:

  • editline β€” the pointer to the struct ec_editline. that's your girl, your main character struct. πŸ‘‘
  • trim_after_cursor β€” a bool, and the source comment says it all fr fr: if true, remove all characters starting from cursor (included). so cursor and everything after it? gone. bye. πŸ’€

and the return type is char *, so it's handing you a string, we love that for us. πŸ¦‹


🌸 RETURN VALUE 🌸

you get back an allocated string holding the current line. iconic. but listen β€” it must be freed by the user. that's on you, bestie, not on the library. 🫢

and if something goes wrong? it returns NULL on error. 😭

no cap: if you forget to free() that string you are lowkey leaking memory and the vibe check will NOT be passed. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

the whole friend group, go say hi:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.


and that's the whole page, bestie β€” libecoli, dated 2026-06-11, and yeah, that EC_EDITLINE_CURLINE(3) header up top is just the vibe check saying hi. mwah, go free your strings πŸ’‹βœ¨

πŸ“¦ where this page comes from