1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

"CR implies LF" patch, based on one from Paul Coldrey.

[originally from svn r7669]
This commit is contained in:
Ben Harris 2007-08-04 19:16:46 +00:00
parent 3dc0f8507d
commit 8659f5145f
6 changed files with 27 additions and 0 deletions

View File

@ -1310,6 +1310,9 @@ void setup_config_box(struct controlbox *b, int midsession,
ctrl_checkbox(s, "Implicit CR in every LF", 'r',
HELPCTX(terminal_lfhascr),
dlg_stdcheckbox_handler, I(offsetof(Config,lfhascr)));
ctrl_checkbox(s, "Implicit LF in every CR", 'f',
HELPCTX(terminal_crhaslf),
dlg_stdcheckbox_handler, I(offsetof(Config,crhaslf)));
ctrl_checkbox(s, "Use background colour to erase screen", 'e',
HELPCTX(terminal_bce),
dlg_stdcheckbox_handler, I(offsetof(Config,bce)));

View File

@ -368,6 +368,19 @@ option, and things might go back to normal:
\c Second line
\c Third line
\S{config-lfcr} \q{Implicit LF in every CR}
\cfg{winhelp-topic}{terminal.crhaslf}
Most servers send two control characters, \i{CR} and \i{LF}, to start a
\i{new line} of the screen. The CR character makes the cursor return to the
left-hand side of the screen. The LF character makes the cursor move
one line down (and might make the screen scroll).
Some servers only send CR, and so the newly
written line is overwritten by the following line. This option causes
a line feed so that all lines are displayed.
\S{config-erase} \q{Use \i{background colour} to erase screen}
\cfg{winhelp-topic}{terminal.bce}

View File

@ -597,6 +597,7 @@ struct config_tag {
FontSpec widefont;
FontSpec wideboldfont;
int shadowboldoffset;
int crhaslf;
};
/*

View File

@ -388,6 +388,7 @@ void save_open_settings(void *sesskey, Config *cfg)
write_setting_i(sesskey, "DECOriginMode", cfg->dec_om);
write_setting_i(sesskey, "AutoWrapMode", cfg->wrap_mode);
write_setting_i(sesskey, "LFImpliesCR", cfg->lfhascr);
write_setting_i(sesskey, "CRImpliesLF", cfg->crhaslf);
write_setting_i(sesskey, "DisableArabicShaping", cfg->arabicshaping);
write_setting_i(sesskey, "DisableBidi", cfg->bidi);
write_setting_i(sesskey, "WinNameAlways", cfg->win_name_always);
@ -681,6 +682,7 @@ void load_open_settings(void *sesskey, Config *cfg)
gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om);
gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);
gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr);
gppi(sesskey, "CRImpliesLF", 0, &cfg->crhaslf);
gppi(sesskey, "DisableArabicShaping", 0, &cfg->arabicshaping);
gppi(sesskey, "DisableBidi", 0, &cfg->bidi);
gppi(sesskey, "WinNameAlways", 1, &cfg->win_name_always);

View File

@ -2850,6 +2850,13 @@ static void term_out(Terminal *term)
term->wrapnext = FALSE;
seen_disp_event(term);
term->paste_hold = 0;
if (term->cfg.crhaslf) {
if (term->curs.y == term->marg_b)
scroll(term, term->marg_t, term->marg_b, 1, TRUE);
else if (term->curs.y < term->rows - 1)
term->curs.y++;
}
if (term->logctx)
logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII);
break;

View File

@ -42,6 +42,7 @@
#define WINHELP_CTX_terminal_autowrap "terminal.autowrap:config-autowrap"
#define WINHELP_CTX_terminal_decom "terminal.decom:config-decom"
#define WINHELP_CTX_terminal_lfhascr "terminal.lfhascr:config-crlf"
#define WINHELP_CTX_terminal_crhaslf "terminal.crhaslf:config-lfcr"
#define WINHELP_CTX_terminal_bce "terminal.bce:config-erase"
#define WINHELP_CTX_terminal_blink "terminal.blink:config-blink"
#define WINHELP_CTX_terminal_answerback "terminal.answerback:config-answerback"