Skip to content

Commit

Permalink
Curses: added support for cool Unicode icons (refs #5)
Browse files Browse the repository at this point in the history
* Practically requires one of the "Nerd Font" fonts,
  so it's disabled by default.
  Add 0,512ED to the profile to enable them.
* The new ED flag could be used to control Gtk icons as well,
  but they are left always-enabled for the time being.
  Is there any reason anybody would like to disable icons in Gtk?
* The list of icons has been adapted and extended from exa:
  https://github.com/ogham/exa/blob/master/src/output/icons.rs
* The icons are hardcoded as presorted lists,
  so we can binary search them.
  This could change in the future. If there is any demand,
  they could be made configurable via Q-Registers as well.
  • Loading branch information
rhaberkorn committed Sep 16, 2024
1 parent bc859a0 commit 8744502
Show file tree
Hide file tree
Showing 9 changed files with 473 additions and 14 deletions.
6 changes: 6 additions & 0 deletions doc/sciteco.7.template
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,12 @@ Scinterm manual, documenting the mapping of
Scinterm manual
.UE
.TP
Suitable terminal fonts for icon support in Curses (see
.BR ED command).
.UR https://www.nerdfonts.com/
Nerd Fonts
.UE
.TP
Gtk+ 3 documentation, containg details about
its CSS support and syntax:
.UR https://developer.gnome.org/gtk3/stable/GtkCssProvider.html
Expand Down
3 changes: 3 additions & 0 deletions sample.teco_ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ EMQ[$SCITECOPATH]/fnkeys.tes
! Uncomment if XTerm allows clipboard operations !
! 0,256ED !

! Uncomment to enable Unicode icons in the Curses UI !
! 0,512ED !

! Uncomment to tweak the memory limit !
! 500*1000*1000,2EJ !

Expand Down
5 changes: 5 additions & 0 deletions src/core-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,11 @@ teco_state_ecommand_close(teco_machine_main_t *ctx, GError **error)
* Should only be enabled if XTerm allows the
* \fIGetSelection\fP and \fISetSelection\fP window
* operations.
* - 512: Enable/Disable Unicode icons in the Curses UI.
* This requires a capable font, like the ones provided
* by the \(lqNerd Fonts\(rq project.
* Changes to this flag in interactive mode may not become
* effective immediately.
*
* The features controlled thus are discribed in other sections
* of this manual.
Expand Down
3 changes: 2 additions & 1 deletion src/interface-curses/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ AM_CFLAGS = -std=gnu11 -Wall -Wno-initializer-overrides -Wno-unused-value
noinst_LTLIBRARIES = libsciteco-interface.la
libsciteco_interface_la_SOURCES = interface.c \
curses-utils.c curses-utils.h \
curses-info-popup.c curses-info-popup.h
curses-info-popup.c curses-info-popup.h \
curses-icons.c curses-icons.h
Loading

0 comments on commit 8744502

Please sign in to comment.