Skip to content

Commit

Permalink
understyles; #72
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyg committed Oct 4, 2024
1 parent 5401f2f commit 7a711e9
Show file tree
Hide file tree
Showing 26 changed files with 475 additions and 181 deletions.
20 changes: 16 additions & 4 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
-*- encoding: utf-8; -*-

Mon Sep 9 00:10:31 2024 adamy
Tue Oct 1 22:28:50 2024 adamy

* Tickets

- grunch crash, on an invalid switch case; #83

- Putty profile; #87
- understyles; #72

Thu Sep 26 21:27:49 2024 adamy

* build-27

* Tickets

- xterm-mok2 and kbprotocol options; #85
- mouse-sgr and mouse-mode; #84
- grunch crash, on an invalid switch case; #83
- portability improvements; non Linux/WIN32 builds; #78
- dark/light background detection; #76
- directory open; prompt file(s) to open; #73
Expand All @@ -15,6 +26,7 @@ Mon Sep 9 00:10:31 2024 adamy

* Keyboard/interface extensions

- keyboard, protocol options (none,auto,basic,mok2,cygwin).
- mouse
- command line option (xterm, xterm2 and sgr).
- <Button-xxx> key events cleanup.
Expand All @@ -28,7 +40,7 @@ Mon Sep 9 00:10:31 2024 adamy
* CI Pipelines

- Solaris
- FreeBSD/OpenBSD and NetBSD
- FreeBSD/OpenBSD and NetBSD.

Sun Jun 16 12:09:22 2024 adamy

Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ On completion the resulting configuration shall be presented, including installa
Once reviewed execute the following:

$ make release


### Windows

Expand Down
11 changes: 7 additions & 4 deletions gr/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- mode: mak; indent-tabs-mode: t; tab-width: 8 -*-
# $Id: Makefile.in,v 1.101 2024/09/19 15:43:53 cvsuser Exp $
# $Id: Makefile.in,v 1.102 2024/10/02 12:35:07 cvsuser Exp $
# GRIEF editor makefile.
#
#
Expand Down Expand Up @@ -417,13 +417,16 @@ $(D_BIN)/$(TARGET): $(OBJS)
-@mkdir $(@D)
@echo "++ do not delete, managed content ++" > $@

artifacts: grlicense.h gr.manifest.xml
artifacts: grlicense.h

ifeq ("win32","@build_os@")
artifacts: gr.manifest.xml
gr.rc: gr.manifest.xml

XCLEAN += gr.manifest.xml
gr.manifest.xml: ../win32/exe.manifest.in ../include/edbuildinfo.h
$(PERL) ../win32/mkmanifest.pl --defines ../include/edbuildinfo.h ../win32/exe.manifest.in gr.manifest.xml

gr.rc: gr.manifest.xml
endif #build_os

XCLEAN += grlicense.h
grlicense.h: Makefile ../util/mklicense.pl ../COPYING
Expand Down
19 changes: 12 additions & 7 deletions gr/cmain.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_cmain_c,"$Id: cmain.c,v 1.65 2024/09/25 15:51:54 cvsuser Exp $")
__CIDENT_RCSID(gr_cmain_c,"$Id: cmain.c,v 1.67 2024/10/02 16:24:52 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: cmain.c,v 1.65 2024/09/25 15:51:54 cvsuser Exp $
/* $Id: cmain.c,v 1.67 2024/10/02 16:24:52 cvsuser Exp $
* Main body, startup and command-line processing.
*
*
Expand Down Expand Up @@ -165,7 +165,9 @@ static struct argoption options[] = {

{ "nounicode", arg_none, NULL, 307, "Disable use of UNICODE graphic characters" },

{ "nounderline", arg_none, NULL, 6, "Disable use of underline mode" },
{ "nounderline", arg_none, NULL, 323, "Disable use of all underline/undestylee modes" },

{ "noundercurl", arg_none, NULL, 324, "Disable use of extended understyle modes" },

{ "nohilite", arg_none, NULL, 7, "Disable syntax hiliting" },

Expand Down Expand Up @@ -329,7 +331,7 @@ int xf_sigtrap = TRUE; /* TRUE/FALSE, control signal tr

int xf_dumpcore = 0; /* 1=dumpcore, 2=stack-dump (if available). */

int xf_underline = -1; /* TRUE/FALSE, user specified underline mode. */
int xf_understyle = UNDERSTYLE_LINE|UNDERSTYLE_EXTENDED|UNDERSTYLE_BLINK;

int xf_title = -1; /* TRUE/FALSE, user specified console title mode. */

Expand Down Expand Up @@ -1054,8 +1056,12 @@ argv_process(const int doerr, int argc, const char **argv)
xf_kbconfig = args.val;
break;

case 6: /* tty - underline mode. */
xf_underline = FALSE;
case 323: /* tty - nounderline. */
xf_understyle = 0;
break;

case 324: /* tty - noundercurl. */
xf_understyle &= ~UNDERSTYLE_EXTENDED;
break;

case 7: /* tty - disable syntax hiliting. */
Expand Down Expand Up @@ -2092,4 +2098,3 @@ usage(int what)
}

/*end*/

26 changes: 21 additions & 5 deletions gr/color.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef GR_COLOR_H_INCLUDED
#define GR_COLOR_H_INCLUDED
#include <edidentifier.h>
__CIDENT_RCSID(gr_color_h,"$Id: color.h,v 1.10 2014/10/22 02:32:54 ayoung Exp $")
__CIDENT_RCSID(gr_color_h,"$Id: color.h,v 1.14 2024/10/02 16:24:52 cvsuser Exp $")
__CPRAGMA_ONCE

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: color.h,v 1.10 2014/10/22 02:32:54 ayoung Exp $
/* $Id: color.h,v 1.14 2024/10/02 16:24:52 cvsuser Exp $
* Color configuration.
*
*
Expand Down Expand Up @@ -238,8 +238,16 @@ typedef struct {
#define COLORSOURCE_RGB 4 /* #RRGGBB|rgb:<red>/<green>/<blue>|rgbi:<red><green><blue> */
#define COLORSOURCE_RGBLABEL 5 /* <name> == RGB */
#define COLORSOURCE_RGBCVT 6 /* converted RGB value to current color depth */

#define COLOR_RGB(_r, _g, _b) ((int)((unsigned char)(_r) | ((int)(unsigned char)(_g) << 8) | ((int)(unsigned char)(_b) << 16)))
#define COLOR_RVAL(_rgb) ((_rgb) & 0xff)
#define COLOR_GVAL(_rgb) ((_rgb) >> 8) & 0xff)
#define COLOR_BVAL(_rgb) ((_rgb) >> 16) & 0xff)

} colvalue_t;

typedef unsigned colstyles_t;

#define COLATTR_INIT { COLVALUE_INIT, COLVALUE_INIT, 0 }

typedef struct {
Expand All @@ -255,9 +263,17 @@ typedef struct {
#define COLORSTYLE_ITALIC 0x0040
#define COLORSTYLE_REVERSE 0x0080

#define COLORSTYLE_ISBOLD 0x0100 /* BOLD has been applied */
#define COLORSTYLE_ISDIM 0x0200 /* DIM has been applied */
int sf;
#define COLORSTYLE_UNDERMASK 0x1f00
#define COLORSTYLE_UNDERSTYLE(_a) ((_a) & COLORSTYLE_UNDERMASK)
#define COLORSTYLE_UNDERSINGLE 0x0100
#define COLORSTYLE_UNDERDOUBLE 0x0200
#define COLORSTYLE_UNDERCURLY 0x0400
#define COLORSTYLE_UNDERDOTTED 0x0800
#define COLORSTYLE_UNDERDASHED 0x1000

#define COLORSTYLE_ISBOLD 0x4000 /* BOLD has been applied */
#define COLORSTYLE_ISDIM 0x8000 /* DIM has been applied */
colstyles_t sf;
int val;
} colattr_t;

Expand Down
5 changes: 2 additions & 3 deletions gr/dialog.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_dialog_c,"$Id: dialog.c,v 1.35 2024/09/25 13:59:56 cvsuser Exp $")
__CIDENT_RCSID(gr_dialog_c,"$Id: dialog.c,v 1.36 2024/10/01 17:16:21 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: dialog.c,v 1.35 2024/09/25 13:59:56 cvsuser Exp $
/* $Id: dialog.c,v 1.36 2024/10/01 17:16:21 cvsuser Exp $
* Dialog manager.
*
*
Expand Down Expand Up @@ -1683,7 +1683,6 @@ dialog_default(WIDGET_t *w, WIDGETMSG_t msg, WIDGETARG_t p1, WIDGETARG_t p2)
case DLGA_STYLES:
data->d_u.ivalue = d->d_styles;
data->d_type = D_INT;
d->d_styles;
return TRUE;
}
}
Expand Down
6 changes: 2 additions & 4 deletions gr/keyboard.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_keyboard_c,"$Id: keyboard.c,v 1.80 2024/09/25 15:51:54 cvsuser Exp $")
__CIDENT_RCSID(gr_keyboard_c,"$Id: keyboard.c,v 1.81 2024/10/02 16:24:52 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: keyboard.c,v 1.80 2024/09/25 15:51:54 cvsuser Exp $
/* $Id: keyboard.c,v 1.81 2024/10/02 16:24:52 cvsuser Exp $
* Manipulate key maps and bindings.
*
*
Expand Down Expand Up @@ -4066,5 +4066,3 @@ inq_kbd_name(void) /* string ([int kbdid]) */
}

/*end*/


5 changes: 2 additions & 3 deletions gr/keyboard.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef GR_KEYBOARD_H_INCLUDED
#define GR_KEYBOARD_H_INCLUDED
#include <edidentifier.h>
__CIDENT_RCSID(gr_keyboard_h,"$Id: keyboard.h,v 1.28 2024/09/25 15:51:54 cvsuser Exp $")
__CIDENT_RCSID(gr_keyboard_h,"$Id: keyboard.h,v 1.29 2024/10/02 16:24:52 cvsuser Exp $")
__CPRAGMA_ONCE

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: keyboard.h,v 1.28 2024/09/25 15:51:54 cvsuser Exp $
/* $Id: keyboard.h,v 1.29 2024/10/02 16:24:52 cvsuser Exp $
* Key maps and binding management.
*
*
Expand Down Expand Up @@ -106,4 +106,3 @@ extern int32_t x_character; /* Current character typed. */
__CEND_DECLS

#endif /*GR_KEYBOARD_H_INCLUDED*/

26 changes: 17 additions & 9 deletions gr/m_color.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_m_color_c,"$Id: m_color.c,v 1.50 2024/07/11 10:20:05 cvsuser Exp $")
__CIDENT_RCSID(gr_m_color_c,"$Id: m_color.c,v 1.54 2024/10/02 12:30:33 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: m_color.c,v 1.50 2024/07/11 10:20:05 cvsuser Exp $
/* $Id: m_color.c,v 1.54 2024/10/02 12:30:33 cvsuser Exp $
* Color configuration.
*
*
Expand Down Expand Up @@ -189,12 +189,15 @@ static const struct {
{ NFIELD("bold"), COLORSTYLE_BOLD },
{ NFIELD("inverse"), COLORSTYLE_INVERSE },
{ NFIELD("underline"), COLORSTYLE_UNDERLINE },
{ NFIELD("underdouble"), COLORSTYLE_UNDERDOUBLE },
{ NFIELD("undercurl"), COLORSTYLE_UNDERCURLY }, /* undercurl if available, otherwise underline */
{ NFIELD("underdot"), COLORSTYLE_UNDERDOTTED },
{ NFIELD("underdash"), COLORSTYLE_UNDERDASHED },
{ NFIELD("blink"), COLORSTYLE_BLINK },
{ NFIELD("italic"), COLORSTYLE_ITALIC },
{ NFIELD("reverse"), COLORSTYLE_REVERSE }, /* generally same as INVERSE */
{ NFIELD("standout"), COLORSTYLE_STANDOUT },
{ NFIELD("dim"), COLORSTYLE_DIM },
{ NFIELD("undercurl"), COLORSTYLE_UNDERLINE }, /* undercurl is a curly underline, generally underline */

{ NFIELD("bold"), COLORSTYLE_ISBOLD }, /* BOLD, yet applied */
{ NFIELD("dim"), COLORSTYLE_ISDIM }, /* DIM, yet applied */
Expand Down Expand Up @@ -1773,10 +1776,6 @@ col_encode(const colors_t *colors, const struct attribute *ap, const colattr_t *
char buf[ATTRIBUTES_WIDTH];
colattr_t ret = *ca;

if (ret.sf < 0) {
ret.sf = 0; /* assign default */
}

ret.fg = col_static(colors, &ret.fg);

if (COL_HILITE_BACKGROUND == ap->ca_enum) { /* special -- hilite, both fg and bg */
Expand Down Expand Up @@ -2038,7 +2037,6 @@ col_apply(colors_t *colors)
assert(ca.fg.color >= -1); //>= 0
assert(ca.bg.source >= COLORSOURCE_NONE); //>= SYMBOLIC
assert(ca.bg.color >= -1); //>= 0
assert(ca.sf >= 0);

x_attrs[ attr ].fg = ca.fg;
x_attrs[ attr ].bg = ca.bg;
Expand Down Expand Up @@ -3134,7 +3132,16 @@ style_print(int sf, char *buf, int length)
unsigned i;

for (i = 0; idx < length && i < (unsigned)(sizeof(x_style_names)/sizeof(x_style_names[0])); ++i) {
if (sf & x_style_names[i].sn_value) {
const int sn_value = x_style_names[i].sn_value;
int set;

if (sn_value & COLORSTYLE_UNDERMASK) { // bit-set
set = (COLORSTYLE_UNDERSTYLE(sf) == sn_value);
} else { // bit-value
set = (sf & sn_value);
}

if (set) {
idx += sxprintf(buf + idx, length - idx, "%c%s", delimiter, x_style_names[i].sn_name);
delimiter = ',';
}
Expand All @@ -3144,3 +3151,4 @@ style_print(int sf, char *buf, int length)
}

/*end*/

24 changes: 16 additions & 8 deletions gr/m_terminal.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_m_terminal_c,"$Id: m_terminal.c,v 1.23 2024/09/25 15:51:54 cvsuser Exp $")
__CIDENT_RCSID(gr_m_terminal_c,"$Id: m_terminal.c,v 1.25 2024/10/02 14:30:20 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: m_terminal.c,v 1.23 2024/09/25 15:51:54 cvsuser Exp $
/* $Id: m_terminal.c,v 1.25 2024/10/02 14:30:20 cvsuser Exp $
* Terminal screen and keyboard primitives.
*
*
Expand Down Expand Up @@ -117,7 +117,7 @@ static struct pt_map pt_features[] = {
{ TF_INIT, PT_MKSTR(x_pt.pt_init), "init" },

/*
* non-order specific
* non-order specific:
*
* o colorset_fgbg - Sequence, color set control sequence foreground and background.
* o colorset_fg - Sequence, set foreground color.
Expand All @@ -128,6 +128,12 @@ static struct pt_map pt_features[] = {
* o default_bg_color - Numeric, terminals default background color.
* o scheme_dark - Boolean, *true* if a dark color scheme is desired, otherwise light.
*
* o under_style - Sequence, general underline style; 0=none,1=normal,2=double,3=curly,4=dotted,5=dashed
* o under_off - Sequence, clear underline style.
* o under_double - Sequence, double underline style.
* o under_curl - Sequence, curly underline style.
* o under_dotted - Sequence, dotted underline style.
* o under_dashed - Sequence, dashed underline style.
*/
// { TF_COLORSET_FG, PT_MKSTR(x_pt.pt_colorsetfg), "color_set_fg" },
// { TF_COLORSET_BG, PT_MKSTR(x_pt.pt_colorsetbg), "color_set_bg" },
Expand All @@ -143,6 +149,13 @@ static struct pt_map pt_features[] = {
{ TF_COLORPALETTE, PT_MKSTR(x_pt.pt_colorpalette), "color_palette" },
{ TF_COLORSCHEME, PT_MKSTR(x_pt.pt_colorscheme), "color_scheme" },

{ TF_UNDERSTYLE, PT_MKSTR(x_pt.pt_understyle), "under_style" }, // 0=none,1=normal,2=double,3=curly,4=dotted,5=dashed
{ TF_UNDEROFF, PT_MKSTR(x_pt.pt_underoff), "under_off" },
{ TF_UNDERDOUBLE, PT_MKSTR(x_pt.pt_underdouble), "under_double" },
{ TF_UNDERCURL, PT_MKSTR(x_pt.pt_undercurl), "under_curl" },
{ TF_UNDERDOTTED, PT_MKSTR(x_pt.pt_underdotted), "under_dotted" },
{ TF_UNDERDASHED, PT_MKSTR(x_pt.pt_underdashed), "under_dashed" },

{ TF_EIGHT_BIT, PT_MKFLG(x_pt.pt_8bit), "eight_bit" },
{ TF_MOUSE, PT_MKSTR(x_pt.pt_mouse), "mouse" },
{ TF_MOUSECLKMS, PT_MKINT(x_pt.pt_mouseclkms), "mouse_clickms" },
Expand Down Expand Up @@ -1390,8 +1403,3 @@ do_get_term_keyboard(void) /* list () */
}

/*end*/





6 changes: 2 additions & 4 deletions gr/m_tokenize.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_m_tokenize_c,"$Id: m_tokenize.c,v 1.29 2024/07/05 18:33:16 cvsuser Exp $")
__CIDENT_RCSID(gr_m_tokenize_c,"$Id: m_tokenize.c,v 1.30 2024/10/02 14:33:38 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: m_tokenize.c,v 1.29 2024/07/05 18:33:16 cvsuser Exp $
/* $Id: m_tokenize.c,v 1.30 2024/10/02 14:33:38 cvsuser Exp $
* String primitives.
*
*
Expand Down Expand Up @@ -1723,5 +1723,3 @@ main(int argc, char *argv[]) {

/*eof*/



Loading

0 comments on commit 7a711e9

Please sign in to comment.