1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Rename term->bidi and term->arabicshaping.

Those two flags had the opposite sense to what you might expect: each
one is the value of the Conf entry corresponding to the checkbox that
_disables_ the corresponding terminal feature. So term->bidi is true
if and only if bidi is _off_.

I think that confusion of naming probably contributed to the control-
flow error fixed in the previous commit, just by increasing cognitive
load until I couldn't remember which flags were set where any more! So
now I've renamed the two fields of Terminal, and the corresponding
Conf keywords, to be called "no_bidi" and "no_arabicshaping", in line
with other 'disable this feature' flags, so that it's clear what the
sense should be.
This commit is contained in:
Simon Tatham 2019-03-26 21:13:19 +00:00
parent 117c7857d2
commit 209dd65ead
5 changed files with 19 additions and 19 deletions

View File

@ -1840,10 +1840,10 @@ void setup_config_box(struct controlbox *b, bool midsession,
I(CONF_no_remote_charset)); I(CONF_no_remote_charset));
ctrl_checkbox(s, "Disable Arabic text shaping", ctrl_checkbox(s, "Disable Arabic text shaping",
'l', HELPCTX(features_arabicshaping), conf_checkbox_handler, 'l', HELPCTX(features_arabicshaping), conf_checkbox_handler,
I(CONF_arabicshaping)); I(CONF_no_arabicshaping));
ctrl_checkbox(s, "Disable bidirectional text display", ctrl_checkbox(s, "Disable bidirectional text display",
'd', HELPCTX(features_bidi), conf_checkbox_handler, 'd', HELPCTX(features_bidi), conf_checkbox_handler,
I(CONF_bidi)); I(CONF_no_bidi));
/* /*
* The Window panel. * The Window panel.

View File

@ -1393,8 +1393,8 @@ NORETURN void cleanup_exit(int);
X(INT, NONE, window_border) /* in pixels */ \ X(INT, NONE, window_border) /* in pixels */ \
X(STR, NONE, answerback) \ X(STR, NONE, answerback) \
X(STR, NONE, printer) \ X(STR, NONE, printer) \
X(BOOL, NONE, arabicshaping) \ X(BOOL, NONE, no_arabicshaping) \
X(BOOL, NONE, bidi) \ X(BOOL, NONE, no_bidi) \
/* Colour options */ \ /* Colour options */ \
X(BOOL, NONE, ansi_colour) \ X(BOOL, NONE, ansi_colour) \
X(BOOL, NONE, xterm_256_colour) \ X(BOOL, NONE, xterm_256_colour) \

View File

@ -679,8 +679,8 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_b(sesskey, "AutoWrapMode", conf_get_bool(conf, CONF_wrap_mode)); write_setting_b(sesskey, "AutoWrapMode", conf_get_bool(conf, CONF_wrap_mode));
write_setting_b(sesskey, "LFImpliesCR", conf_get_bool(conf, CONF_lfhascr)); write_setting_b(sesskey, "LFImpliesCR", conf_get_bool(conf, CONF_lfhascr));
write_setting_b(sesskey, "CRImpliesLF", conf_get_bool(conf, CONF_crhaslf)); write_setting_b(sesskey, "CRImpliesLF", conf_get_bool(conf, CONF_crhaslf));
write_setting_b(sesskey, "DisableArabicShaping", conf_get_bool(conf, CONF_arabicshaping)); write_setting_b(sesskey, "DisableArabicShaping", conf_get_bool(conf, CONF_no_arabicshaping));
write_setting_b(sesskey, "DisableBidi", conf_get_bool(conf, CONF_bidi)); write_setting_b(sesskey, "DisableBidi", conf_get_bool(conf, CONF_no_bidi));
write_setting_b(sesskey, "WinNameAlways", conf_get_bool(conf, CONF_win_name_always)); write_setting_b(sesskey, "WinNameAlways", conf_get_bool(conf, CONF_win_name_always));
write_setting_s(sesskey, "WinTitle", conf_get_str(conf, CONF_wintitle)); write_setting_s(sesskey, "WinTitle", conf_get_str(conf, CONF_wintitle));
write_setting_i(sesskey, "TermWidth", conf_get_int(conf, CONF_width)); write_setting_i(sesskey, "TermWidth", conf_get_int(conf, CONF_width));
@ -1106,8 +1106,8 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppb(sesskey, "AutoWrapMode", true, conf, CONF_wrap_mode); gppb(sesskey, "AutoWrapMode", true, conf, CONF_wrap_mode);
gppb(sesskey, "LFImpliesCR", false, conf, CONF_lfhascr); gppb(sesskey, "LFImpliesCR", false, conf, CONF_lfhascr);
gppb(sesskey, "CRImpliesLF", false, conf, CONF_crhaslf); gppb(sesskey, "CRImpliesLF", false, conf, CONF_crhaslf);
gppb(sesskey, "DisableArabicShaping", false, conf, CONF_arabicshaping); gppb(sesskey, "DisableArabicShaping", false, conf, CONF_no_arabicshaping);
gppb(sesskey, "DisableBidi", false, conf, CONF_bidi); gppb(sesskey, "DisableBidi", false, conf, CONF_no_bidi);
gppb(sesskey, "WinNameAlways", true, conf, CONF_win_name_always); gppb(sesskey, "WinNameAlways", true, conf, CONF_win_name_always);
gpps(sesskey, "WinTitle", "", conf, CONF_wintitle); gpps(sesskey, "WinTitle", "", conf, CONF_wintitle);
gppi(sesskey, "TermWidth", 80, conf, CONF_width); gppi(sesskey, "TermWidth", 80, conf, CONF_width);

View File

@ -1464,13 +1464,13 @@ static void set_erase_char(Terminal *term)
void term_copy_stuff_from_conf(Terminal *term) void term_copy_stuff_from_conf(Terminal *term)
{ {
term->ansi_colour = conf_get_bool(term->conf, CONF_ansi_colour); term->ansi_colour = conf_get_bool(term->conf, CONF_ansi_colour);
term->arabicshaping = conf_get_bool(term->conf, CONF_arabicshaping); term->no_arabicshaping = conf_get_bool(term->conf, CONF_no_arabicshaping);
term->beep = conf_get_int(term->conf, CONF_beep); term->beep = conf_get_int(term->conf, CONF_beep);
term->bellovl = conf_get_bool(term->conf, CONF_bellovl); term->bellovl = conf_get_bool(term->conf, CONF_bellovl);
term->bellovl_n = conf_get_int(term->conf, CONF_bellovl_n); term->bellovl_n = conf_get_int(term->conf, CONF_bellovl_n);
term->bellovl_s = conf_get_int(term->conf, CONF_bellovl_s); term->bellovl_s = conf_get_int(term->conf, CONF_bellovl_s);
term->bellovl_t = conf_get_int(term->conf, CONF_bellovl_t); term->bellovl_t = conf_get_int(term->conf, CONF_bellovl_t);
term->bidi = conf_get_bool(term->conf, CONF_bidi); term->no_bidi = conf_get_bool(term->conf, CONF_no_bidi);
term->bksp_is_delete = conf_get_bool(term->conf, CONF_bksp_is_delete); term->bksp_is_delete = conf_get_bool(term->conf, CONF_bksp_is_delete);
term->blink_cur = conf_get_bool(term->conf, CONF_blink_cur); term->blink_cur = conf_get_bool(term->conf, CONF_blink_cur);
term->blinktext = conf_get_bool(term->conf, CONF_blinktext); term->blinktext = conf_get_bool(term->conf, CONF_blinktext);
@ -1564,10 +1564,10 @@ void term_reconfig(Terminal *term, Conf *conf)
* If the bidi or shaping settings have changed, flush the bidi * If the bidi or shaping settings have changed, flush the bidi
* cache completely. * cache completely.
*/ */
if (conf_get_bool(term->conf, CONF_arabicshaping) != if (conf_get_bool(term->conf, CONF_no_arabicshaping) !=
conf_get_bool(conf, CONF_arabicshaping) || conf_get_bool(conf, CONF_no_arabicshaping) ||
conf_get_bool(term->conf, CONF_bidi) != conf_get_bool(term->conf, CONF_no_bidi) !=
conf_get_bool(conf, CONF_bidi)) { conf_get_bool(conf, CONF_no_bidi)) {
for (i = 0; i < term->bidi_cache_size; i++) { for (i = 0; i < term->bidi_cache_size; i++) {
sfree(term->pre_bidi_cache[i].chars); sfree(term->pre_bidi_cache[i].chars);
sfree(term->post_bidi_cache[i].chars); sfree(term->post_bidi_cache[i].chars);
@ -5058,7 +5058,7 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata,
int it; int it;
/* Do Arabic shaping and bidi. */ /* Do Arabic shaping and bidi. */
if (!term->bidi || !term->arabicshaping || if (!term->no_bidi || !term->no_arabicshaping ||
(ldata->trusted && term->cols > TRUST_SIGIL_WIDTH)) { (ldata->trusted && term->cols > TRUST_SIGIL_WIDTH)) {
if (!term_bidi_cache_hit(term, scr_y, ldata->chars, term->cols, if (!term_bidi_cache_hit(term, scr_y, ldata->chars, term->cols,
@ -5127,10 +5127,10 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata,
nbc++; nbc++;
} }
if(!term->bidi) if(!term->no_bidi)
do_bidi(term->wcFrom, nbc); do_bidi(term->wcFrom, nbc);
if(!term->arabicshaping) { if(!term->no_arabicshaping) {
do_shape(term->wcFrom, term->wcTo, nbc); do_shape(term->wcFrom, term->wcTo, nbc);
} else { } else {
/* If we're not calling do_shape, we must copy the /* If we're not calling do_shape, we must copy the

View File

@ -297,13 +297,13 @@ struct terminal_tag {
bool ansi_colour; bool ansi_colour;
char *answerback; char *answerback;
int answerbacklen; int answerbacklen;
bool arabicshaping; bool no_arabicshaping;
int beep; int beep;
bool bellovl; bool bellovl;
int bellovl_n; int bellovl_n;
int bellovl_s; int bellovl_s;
int bellovl_t; int bellovl_t;
bool bidi; bool no_bidi;
bool bksp_is_delete; bool bksp_is_delete;
bool blink_cur; bool blink_cur;
bool blinktext; bool blinktext;