1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
Commit Graph

382 Commits

Author SHA1 Message Date
Jacob Nevins
0e202b3dcc Cosmetic: clarify that term->xterm_mouse is not boolean, etc.
[originally from svn r8374]
2008-12-20 18:52:09 +00:00
Simon Tatham
4aa9b6a0da Fix a cursor positioning infelicity.
The scenario: I start a small, say 80x24, pterm. I do some work in
it, generating plenty of scrollback, and eventually I `less' a file.
`less' switches to the alt screen. Then I want more vertical space
to look at the file, so I enlarge the window to more like 80x60.
When I quit `less' and switch back to the primary screen, some
scrollback has been pulled down into the screen, as expected - but
the saved _cursor position_ is still at line 24, not at the bottom
of the new terminal where the prompt it goes with has moved to.

Solution: term_size() should adjust the alt-screen saved cursor
positions as well as the normal cursor position.

(Curiously, the problem doesn't happen on my home Debian box, even
without this fix. It happens on my RH9 box at work, though.)

[originally from svn r7911]
2008-03-07 18:30:37 +00:00
Jacob Nevins
868208b8bd Reset mouse reporting mode as part of resetting the terminal.
[originally from svn r7773]
2007-10-27 16:05:02 +00:00
Ben Harris
54321544d4 Suggest another ttymode we could usefully set automatically.
[originally from svn r7709]
2007-09-03 20:33:40 +00:00
Ben Harris
8659f5145f "CR implies LF" patch, based on one from Paul Coldrey.
[originally from svn r7669]
2007-08-04 19:16:46 +00:00
Simon Tatham
7a4ef1491e The direct link between the terminal and the back end via
term_provide_resize_fn() was not being broken when the back end was
destroyed on session termination, causing resizing an inactive PuTTY
to be a segfault hazard.

[originally from svn r7143]
2007-01-24 13:53:28 +00:00
Simon Tatham
42801b7e9e Get rid of all the MSVC warnings.
[originally from svn r7086]
2007-01-09 18:24:07 +00:00
Jacob Nevins
4ae926fa8a Patch inspired by one from Daniel Silverstone in Debian bug #229232:
We now have an option where a remote window title query returns a well-formed
response containing the empty string. This should keep stop any server-side
application that was expecting a response from hanging, while not permitting
the response to be influenced by an attacker.

We also retain the ability to stay schtum. The existing checkbox has thus
grown into a set of radio buttons.

I've changed the default to the "empty string" response, even in the backward-
compatibility mode of loading old settings, which is a change in behaviour;
any users who want the old behaviour back will have to explicitly select it. I
think this is probably the Right Thing. (The only drawback I can think of is
that an attacker could still potentially use the relevant fixed strings for
mischief, but we already have other, similar reports.)

[originally from svn r7043]
2006-12-31 15:33:33 +00:00
Jacob Nevins
9c954238bd CSI 3 J now clears the scrollback, as in xterm.
[originally from svn r6847]
[this svn revision also touched putty-wishlist]
2006-09-05 22:08:00 +00:00
Simon Tatham
6104963b9b Er, ahem. Other half of r6788. :-/
[originally from svn r6791]
[r6788 == 09f86ce7ec]
2006-08-15 22:48:01 +00:00
Simon Tatham
09f86ce7ec Aha! At long last I've managed to reproduce the intermittent problem
I've been having with the cursor sometimes restoring to the wrong
place when screen(1) terminates. The offending sequence of escape
sequences goes ESC 7 (save cursor), ESC [?47h (switch to alternate
screen), ESC 7 (save cursor _again_), do some stuff, ESC 8 (restore
cursor), run screen session for a bit, ESC [?47l (return to main
screen), ESC 8 (restore cursor). The final ESC 8 is expected to
restore the cursor to where it was saved by the initial ESC 7.

Translation: the ESC 7 saved cursor state is part of the state we
must swap out when switching to the alternate screen. In other
words, we need to track _four_ cursor positions: active and saved,
on each of main and alternate screen. Previously we were tracking
only three.

[originally from svn r6788]
2006-08-15 12:45:21 +00:00
Jacob Nevins
a2c060d638 Do not send raw mouse events in the middle of a selection operation, even if
we otherwise would (for instance, if Shift is released before the mouse button
being used for selection).

[originally from svn r6727]
[this svn revision also touched putty-wishlist]
2006-06-11 12:56:52 +00:00
Jacob Nevins
7958a63147 Sprinkle some header comments in various files in an attempt to explain what
they're for.

[originally from svn r6639]
2006-04-23 18:26:03 +00:00
Simon Tatham
8e368671cc Fix inadvertent O(N^2) loop within do_paint() which I just
discovered when profiling IPBT.

[originally from svn r6602]
2006-03-12 14:53:18 +00:00
Simon Tatham
18509f8422 Alain Guibert points out that ESC]P sequences were erroneously
accepting 'G' as a hex digit. (The _first_ digit of the sequence
intentionally goes up further than F, but the remaining ones
shouldn't have.)

[originally from svn r6581]
2006-02-20 19:54:17 +00:00
Jacob Nevins
dd73d2a836 Fix `restart-reset-terminal': terminal now restored to a sensible state when
reusing a window to restart a session.

[originally from svn r6577]
[this svn revision also touched putty-wishlist]
2006-02-19 14:59:48 +00:00
Jacob Nevins
9432d92b91 At last, a fix for `large-clipboard-crash'.
A growable buffer was only being grown for actual text, not for newlines or
trailing NULs. A large run of empty lines could lead to newlines overflowing
the buffer (> 100 should be enough to guarantee this on all platforms, after
the initial 5k size of the buffer).

Also fix some valgrind in the same area (was probably harmless), and a memory
leak introduced by the RTF attribute pasting.

[originally from svn r6570]
[this svn revision also touched putty-wishlist]
2006-02-19 01:37:45 +00:00
Jacob Nevins
9496269c6e Pointer type correction in term_clrsb().
(Harmless, as it happens.)

[originally from svn r6568]
2006-02-18 22:30:10 +00:00
Owen Dunn
d526e3bb33 Preserve more attributes of text copied as RTF. Thanks to Stephen Balousek.
[originally from svn r6555]
2006-02-13 22:18:17 +00:00
Owen Dunn
ad05f78303 Fix zero-rows-cols-crash
[originally from svn r6515]
2006-01-10 20:02:22 +00:00
Simon Tatham
0a4b6612fb A few small changes to make the PuTTY source base more usable as a
basis for other terminal-involving applications: a stub
implementation of the printing interface, an additional function in
notiming.c, and also I've renamed the front-end function beep() to
do_beep() so as not to clash with beep() in lib[n]curses.

[originally from svn r6479]
2005-12-09 20:04:19 +00:00
Jacob Nevins
f164b330ae When a userpass interaction has finished, make sure the 'prompts' structure
is safe for re-use.

[originally from svn r6444]
2005-11-02 23:15:43 +00:00
Jacob Nevins
8719f92c14 Revamp SSH authentication code so that user interaction is more
abstracted out; replace loops structured around a single interaction
per loop with less tortuous code (fixes: `ki-multiprompt-crash',
`ssh1-bad-passphrase-crash'; makes `ssh2-password-expiry' and
`proxy-password-prompt' easier).

The new interaction abstraction has a lot of fields that are unused in
the current code (things like window captions); this is groundwork for
`gui-auth'. However, ssh.c still writes directly to stderr; that may
want to be fixed.

In the GUI apps, user interaction is moved to terminal.c. This should
make it easier to fix things like UTF-8 username entry, although I
haven't attempted to do so. Also, control character filtering can be
tailored to be appropriate for individual front-ends; so far I don't
promise anything other than not having made it any worse.

I've tried to test this fairly exhaustively (although Mac stuff is
untested, as usual). It all seems to basically work, but I bet there
are new bugs. (One I know about is that you can no longer make the
PuTTY window go away with a ^D at the password prompt; this should be
fixed.)

[originally from svn r6437]
[this svn revision also touched putty-wishlist]
2005-10-30 20:24:09 +00:00
Simon Tatham
309ddb5cad Failed to call set_erase_char() after processing SCO colour sequences.
[originally from svn r6379]
2005-10-08 09:09:50 +00:00
Simon Tatham
9d3ab46800 UTF-8 processing was discarding a valid character which interrupted
an otherwise legal sequence, if that valid character was the last
thing in a term_out() run. Spotted by Egmont Koblinger.

[originally from svn r6373]
2005-10-03 11:38:30 +00:00
Jacob Nevins
fb581ac625 First crack at `terminal-modes' in SSH. PuTTY now sends ERASE by default,
Unix Plink sends everything sensible it can find, and it's fully configurable
from the GUI.

I'm not entirely sure about the precise set of modes that Unix Plink should
look at; informed tweaks are welcome.

Also the Mac bits are guesses (but trivial).

[originally from svn r5653]
[this svn revision also touched putty-wishlist]
2005-04-21 13:57:08 +00:00
Jacob Nevins
3d012d9bd0 Pull out parsing of ^C style strings from the terminal answerback code to
its own function, since I'll be wanting it for `terminal-modes'.

[originally from svn r5646]
2005-04-19 18:58:29 +00:00
Jacob Nevins
cf721acc1f #ifdef out expensive combining-character/scrollback diagnostics (for now).
[originally from svn r5589]
2005-04-01 13:25:13 +00:00
Jacob Nevins
9049f43955 `wcwidth-upgrade': upgrade to latest wcwidth.c from Markus Kuhn
<http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c>.
This is identified both internally and in HTTP headers as 2003-05-20,
for Unicode 4.0.

Only changes from upstream are to make mk_wcwidth_cjk() non-static and to
#include "putty.h" for prototypes.

The status of some code points has changed; see the wishlist item. We've
had some feedback from the CJK and Arabic communities that upgrading is
probably the right thing to do.

[originally from svn r5547]
[this svn revision also touched putty-wishlist]
2005-03-23 20:04:08 +00:00
Jacob Nevins
faf59c78be Add an option to use wcwidth_cjk() instead of wcwidth(), as several people
have asked for it.

[originally from svn r5542]
2005-03-22 23:20:23 +00:00
Jacob Nevins
5aa719d16e Consistently use a single notation to refer to SSH protocol versions, as
discussed. Use Barrett and Silverman's convention of "SSH-1" for SSH protocol
version 1 and "SSH-2" for protocol 2 ("SSH1"/"SSH2" refer to ssh.com
implementations in this scheme). <http://www.snailbook.com/terms.html>

[originally from svn r5480]
2005-03-10 16:36:05 +00:00
Jacob Nevins
d860adb55d Fix sense of test in previous checkin :)
[originally from svn r5448]
2005-03-06 15:00:45 +00:00
Simon Tatham
be8acb5615 I'm sick and tired of the persistent reports of lineptr() failing
its `line != NULL' assertion, so I've replaced the assertion with a
call to fatalbox() giving oodles of information. I may still not be
able to reproduce it, but at least next time it happens we should
see a decent amount of debugging data!

[originally from svn r5447]
2005-03-06 14:48:22 +00:00
Ben Harris
3c44ce243f Correct some comments based on feedback from Thomas Dickey.
[originally from svn r5356]
2005-02-19 21:56:25 +00:00
Ben Harris
9f8182ffd7 Explicitly ignore SCI rather than translating it into DECID. Should fix
bug sci-is-not-decid.

[originally from svn r5164]
2005-01-22 14:01:01 +00:00
Owen Dunn
cd58af8938 The terminal reengineering of r4609 left an unused `start' lying around.
Remove it.

[originally from svn r5134]
[r4609 == 709a94e5f2]
2005-01-18 19:04:59 +00:00
Simon Tatham
414aba9f5a In my revamp of cursor handling I had assumed that you were supposed
to call _either_ do_text() _or_ do_cursor() on a given character
cell. In fact you're supposed to call do_text() no matter what, and
then call do_cursor() as well if it's got the cursor on it, since
do_cursor() _only_ draws the actual cursor, which often doesn't also
cause the text to get drawn.

I'm half tempted to change this in the interface, retire do_cursor()
as an external function and relegate it to an internal function in
each front end, and require that do_text() must fully process all
cursor attributes it is passed. However, I haven't done this yet.

[originally from svn r5017]
2004-12-22 10:21:50 +00:00
Simon Tatham
ba470dec5e I _think_ I've just fixed `font-overflow'. term->disptext now tracks
the start of every contiguous run passed to do_text() or
do_cursor(), and arranges never to overwrite only part of such a run
on the next update.

I'm a bit worried about this checkin because I've also completely
revamped cursor handling: the cursor was previously being drawn
_outside_ the main loop over the display line, and is now drawn as
part of that loop when it gets to the cursor location. It _seems_ to
still work sensibly, even in complex cases involving LATTR_WIDE and
double-width CJK characters etc, but I won't be entirely happy until
it's had some beta use.

[originally from svn r5003]
[this svn revision also touched putty-wishlist]
2004-12-17 12:55:12 +00:00
Simon Tatham
f4246872c4 Divide the do_paint() loop into several subloops. The activity of
going through the line and working out which bits need to be redrawn
is now in a separate loop from the subsequent activity of actually
going through and doing the redraws. This _should_ enable me to
tinker with the which-bits-to-redraw data in between the two, thus
fixing `font-overflow'. However, I thought it would be sensible to
break the work up into two commits so we can track bugs in the
restructuring separately from bugs introduced by the new feature.

Also added a couple more terminal test files.

[originally from svn r5001]
2004-12-17 11:37:16 +00:00
Simon Tatham
fb6a1e9d42 I had apparently broken wrapping of double-width characters (again).
Also fixed the new UTF-8 test file so that it tests double-width
wrapping both with _and_ without LATTR_WRAPPED2.

[originally from svn r5000]
2004-12-17 11:24:25 +00:00
Jacob Nevins
a2e01a5604 Abe Crabtree complains that flushing the log file as often as we do in 0.56
results in unacceptable performance for him on Win2000. Add a checkbox to
revert to the old behaviour.

[originally from svn r4988]
[this svn revision also touched putty-wishlist]
2004-12-16 15:22:36 +00:00
Simon Tatham
a10edf435b term_bidi_cache_store() now has a need to distinguish between the
_width_ of a terminal line (number of character cell positions) and
its _size_ (number of termchars), since of course these differ in
the presence of combining characters.

[originally from svn r4938]
2004-12-01 09:25:20 +00:00
Simon Tatham
44aca28fad Fix large memory leak introduced in the r4915 bidi changes.
[originally from svn r4936]
[r4915 == 569da2eb7b]
2004-11-30 13:39:58 +00:00
Simon Tatham
e4e10e494b Implement xterm 256-colour mode.
[originally from svn r4917]
[this svn revision also touched putty-wishlist]
2004-11-28 15:13:34 +00:00
Simon Tatham
569da2eb7b Cursor position, selection highlights and mouse clicks are now all
transformed back and forth according to the character position
permutation output from the bidi algorithm. I was expecting that to
be a lot harder.

[originally from svn r4915]
2004-11-28 09:24:57 +00:00
Simon Tatham
92f3b101f5 Slight improvement to cursor blink timing: since the cursor doesn't
blink when the window doesn't have focus, we don't schedule blink
timers at that point either.

Infrastructure change: term->has_focus should now not be written
directly from outside terminal.c. Instead, use the function
term_set_focus, which will sort out the blink timers as well.

[originally from svn r4911]
2004-11-27 19:34:45 +00:00
Simon Tatham
7ecf13564a New timing infrastructure. There's a new function schedule_timer()
which pretty much any module can call to request a call-back in the
future. So terminal.c can do its own handling of blinking, visual
bells and deferred screen updates, without having to rely on
term_update() being called 50 times a second (fixes: pterm-timer);
and ssh.c and telnet.c both invoke a new module pinger.c which takes
care of sending keepalives, so they get sent uniformly in all front
ends (fixes: plink-keepalives, unix-keepalives).

[originally from svn r4906]
[this svn revision also touched putty-wishlist]
2004-11-27 13:20:21 +00:00
Simon Tatham
1fd5bcc9fa Fix typo in term_size(), flagged by a Dr Watson log from Temme Rainer.
[originally from svn r4881]
2004-11-22 13:49:12 +00:00
Simon Tatham
814408f2d3 DJSD requests a force-monochrome option for users who dislike angry-
fruit-salad applications :-)

[originally from svn r4762]
2004-11-09 17:57:32 +00:00
Simon Tatham
d412fed542 Fix bug in scrollback compression, which manifested when attempting
to encode a very long (len>128) run of the same literal.

[originally from svn r4647]
2004-10-16 12:36:50 +00:00
Simon Tatham
70230fc0ca Fix two memory leaks in the new code. (There's no point compressing
the scrollback if you then leak away all the memory you saved!) One
of the leaks - by far the bigger of the two - was in my temporary
diagnostic function cc_check(), which is particularly embarrassing :-)

[originally from svn r4638]
2004-10-15 12:37:44 +00:00
Simon Tatham
5f05f03fb2 Add missing check_boundary() calls in destructive backspace handler.
[originally from svn r4635]
2004-10-15 11:51:26 +00:00
Simon Tatham
833bcbb559 A combining character on U+0020 SPACE stops it from being
`uninteresting' to the clipboard processing.

[originally from svn r4634]
2004-10-15 11:42:02 +00:00
Simon Tatham
89e36c9567 Mark the trial decompress in every call to compressline() with the
XXX-REMOVE-BEFORE-RELEASE tag.

[originally from svn r4633]
2004-10-15 11:29:02 +00:00
Simon Tatham
9b37d130ed Don't forget to flush the bidi cache when the user enables or
disables bidi or shaping, otherwise they'll have to do a manual
screen refresh to see any difference.

[originally from svn r4632]
2004-10-15 11:14:42 +00:00
Simon Tatham
6b136f5c2f Store line widths in the bidi cache, so we don't fail to re-bidi a
line when the window size changes.

[originally from svn r4631]
2004-10-15 11:11:19 +00:00
Simon Tatham
0d05595db9 Fix many bugs in resizeline().
[originally from svn r4629]
2004-10-15 10:48:27 +00:00
Simon Tatham
845138a1e8 Fix applying combining characters to double-width characters.
[originally from svn r4628]
2004-10-15 09:28:46 +00:00
Simon Tatham
8d7edeafd3 Fix Windows redraw problem on RH half of wrapped lines. (term_paint
was checking whether lattr == LATTR_NORM, where it should have been
checking (lattr & LATTR_MODE) to mask off LATTR_WRAPPED et al.

[originally from svn r4627]
2004-10-15 09:16:58 +00:00
Simon Tatham
e49ce5559b I broke ordinary line wrapping as a result of retiring cpos. Oops.
[originally from svn r4626]
2004-10-15 09:06:45 +00:00
Simon Tatham
db54732e38 Fix cursor display on a combined character cell.
[originally from svn r4625]
2004-10-15 08:51:57 +00:00
Simon Tatham
557256c38e Mark cc_check() and all calls to it with the new
XXX-REMOVE-BEFORE-RELEASE tag, since they're performance-intensive.
And now that I'm reasonably confident of remembering to remove them
before the next release, I feel less guilty about adding them willy-
nilly all over the place, so I've shoved in a couple more for now :-)

[originally from svn r4624]
2004-10-15 08:22:49 +00:00
Simon Tatham
089775eb02 First-stage support for Unicode combining characters. The `chars'
array of each `termline' structure now contains optional additional
entries after the normal number of columns, which are used to chain
a linked list of combining characters off any primary termchar that
needs it. This means we support arbitrarily many combining
characters per cell (unlike xterm's hard limit of 2).

Cut and paste works correctly (selecting a character cell containing
multiple code points causes all those code points to be cut and
pasted). Display works by simply overlaying all the relevant
characters on top of one another; this is good enough for Unix
(xterm does the same thing), and mostly seems OK for Windows except
that the Windows Unicode fonts have a nasty habit of not containing
most of the combining characters and thus overlaying an
unknown-code-point box on your perfectly good base glyph.

I had no idea how to add support in the Mac do_text(), so I've
simply stuck in an assertion that will trigger the first time a
combining character is displayed, and hopefully this will bite
someone with the clue to fix it.

[originally from svn r4622]
2004-10-14 16:42:43 +00:00
Simon Tatham
8f656a37b5 Fix segfaults in terminal resizing, introduced by re-engineering.
[originally from svn r4613]
2004-10-13 13:35:29 +00:00
Simon Tatham
709a94e5f2 Re-engineering of terminal emulator, phase 1.
The active terminal screen is no longer an array of `unsigned long'
encoding 16-bit Unicode plus 16 attribute bits. Now it's an array of
`termchar' structures, which currently have 32-bit Unicode and 32
attribute bits but which will probably expand further in future.

To prevent bloat of the memory footprint, I've introduced a mostly
RLE-like compression scheme for storing scrollback: each line is
compressed into a compact (but hard to modify) form when it moves
into the term->scrollback tree, and is temporarily decompressed when
the user wants to scroll back over it. My initial tests suggest that
this compression averages about 1/4 of the previous (32 bits per
character cell) data size in typical output, which means this is an
improvement even without counting the new ability to extend the
information stored in each character cell.

Another beneficial side effect is that the insane format in which
Unicode was passed to front ends through do_text() has now been
rendered sane.

Testing is incomplete; this _may_ still have instabilities. Windows
and Unix front ends both seem to work as far as I've looked, but I
haven't yet looked very hard. The Mac front end I've edited (it
seemed obvious how to change it) but I can't compile or test it.

As an immediate functional effect, the terminal emulator now
supports full 32-bit Unicode to whatever extent the host platform
allows it to. For example, if you output a 4-or-more-byte UTF-8
character in Unix pterm, it will not display it properly, but it
will correctly paste it back out in a UTF8_STRING selection. Windows
is more restricted, sadly.

[originally from svn r4609]
2004-10-13 11:50:16 +00:00
Jacob Nevins
088a1d37e9 Flush the logfile reasonably frequently in `printable output only' and
`all session data' modes, without completely mauling the performance, by
fflush()ing once per term_out(). If anyone complains I suppose we can
make this optional.

[originally from svn r4445]
2004-08-12 01:02:01 +00:00
Simon Tatham
deaeb2a287 We shouldn't reference off the end of the display line when checking
for UCSWIDE. Thanks Jacob, for catching this with valgrind.

[originally from svn r4338]
2004-07-20 20:13:25 +00:00
Simon Tatham
fb7dd5a255 At last! After much delay, much faffing back and forth, and much
enhancement and fiddling, I have now massaged Arabeyes' first patch
into a form I'm happy to check in. Phew.

[originally from svn r4236]
2004-05-22 10:36:50 +00:00
Owen Dunn
e4f30d3b7a Make `Copy all to Clipboard' copy all non-empty lines from the
scrollback and the terminal to the clipboard, rather than just the
content before the cursor.  Should fix copyall-to-cursor.

[originally from svn r3929]
2004-03-10 17:11:12 +00:00
Simon Tatham
0f259c23ea Various uninitialised-variable accesses picked up by valgrind.
[originally from svn r3723]
2004-01-17 14:25:36 +00:00
Jacob Nevins
8e2fd15bd5 Remove all the "assert(len>0)" which forbade zero-length writes across the
from_backend() interface, after having made all implementations safe against
being called with len==0 and possibly-NULL/undefined "data".

(This includes making misc.c:bufchain_add() more robust in this area.)

Assertion was originally added 2002-03-01; e.g., see plink.c:1.53 [r1571].

I believe this now shouldn't break anything.

This should hopefully make `ppk-empty-comment' finally GO AWAY. (Tested
with Unix PuTTY.)

[originally from svn r3500]
[r1571 == fdbd697801]
2003-10-12 13:16:39 +00:00
Owen Dunn
893c432a77 Consider bells as a display event.
[originally from svn r3329]
2003-07-05 11:35:33 +00:00
Ben Harris
b287bd5606 Improve SCOANSI emulation: The colours that SGR 0 returns to are now changed
by the SCO SNF and SNB sequences, which seems to be what the SCO console does
(at least in the new mode documented for OpenServer 5.0.6).

[originally from svn r3286]
2003-06-21 22:40:42 +00:00
Ben Harris
a00efa525a Add comments to case statements containing the mnemonics for the various
escape and control sequences.  This should make it easier to find the
implementation of the one you're interested in.

[originally from svn r3283]
2003-06-21 19:38:56 +00:00
Ben Harris
68da549341 Support for more SCO ANSI escape sequences:
CSI = Ps c
CSI = Pn1 ; Pn2 C
CSI = Ps D
CSI = Ps F
CSI = Ps G
SGR 6

Patch derived from one supplied by Leonid Lisoskiy, with several fixes from me.

[originally from svn r3263]
2003-06-15 22:05:05 +00:00
Simon Tatham
171ce1e780 Experimental change in the behaviour of `disable alternate terminal
screen'. Now it also disables the save-and-restore-cursor behaviour
of ESC[?1048h and ESC[?1049h, since these sequences seem to be
output by software trying to switch to the alternate screen, and it
looks very odd to have the cursor position restored to where it was
before `less' when the garbage `less' wrote all over the screen is
still around. The `traditional' ESC 7 and ESC 8 still function as
normal, on the basis that they aren't usually used in conjunction
with the alternate screen. I'm not sure whether this will be the
right decision; I'm prepared to change it back if a sufficiently
serious counterexample shows up.

[originally from svn r3222]
2003-05-27 09:43:14 +00:00
Simon Tatham
beea582b35 Should fix Debian bug #192674: another gcc complaint about
potentially uninitialised variable.

[originally from svn r3172]
2003-05-10 08:37:54 +00:00
Simon Tatham
041dcfd83d Unix makefile now uses -O2, which massively cuts down key exchange
time. This gives rise to a whole bunch of spare warnings, one or two
of which might have been actual bugs; now all resolved.

[originally from svn r3134]
2003-04-23 13:48:09 +00:00
Simon Tatham
8f94dd3881 Mid-session BCE reconfiguration wasn't taking effect immediately
because I forgot to set term->erase_char in response to the change
in term->use_bce. Oops.

[originally from svn r3105]
2003-04-12 09:05:28 +00:00
Simon Tatham
4b6ffd99f1 Disable window title reporting by default, since it's a security
hazard. I considered removing it completely, but I can't rule out
the possibility of an OS that actually takes security of its
terminal devices seriously, and which might be able to make sensible
and safe use of this feature.

[originally from svn r3103]
2003-04-12 08:59:06 +00:00
Simon Tatham
d93f7113d1 Rationalisation of the system of frontend handles. Most modular bits
of PuTTY (terminal, backend, logctx etc) take a `void *' handle
passed to them from the frontend, and used as a context for all
their callbacks. Most of these point at the frontend structure
itself (on platforms where this is meaningful), except that the
handle passed to the backend has always pointed at the terminal
because from_backend() was implemented in terminal.c. This has
finally bitten Unix PuTTY, because both backend and logctx have
been passing their respective and very different frontend handles to
logevent(), so I've fixed it.
from_backend() is now a function supplied by the _frontend_ itself,
in all cases, and the frontend handle passed to backends must be the
same as that passed to everything else. What was from_backend() in
terminal.c is now called term_data(), and the typical implementation
of from_backend() in a GUI frontend will just extract the terminal
handle from the frontend structure and delegate to that.
This appears to work on Unix and Windows, but has most likely broken
the Mac build.

[originally from svn r3100]
2003-04-11 18:36:27 +00:00
Simon Tatham
ed46f3aa53 `Copy All' ought to de-highlight any existing selection, in line
with any other operation that shifts the X selection to stuff other
than the highlighted text.

[originally from svn r3098]
2003-04-11 18:10:13 +00:00
Simon Tatham
5107780c54 pterm now uses the new uxsel module, so it's one step closer to
being able to be a PuTTY as well as a pterm. In the process I've
also moved icky things like actually reading from the pty fd and
printing the `terminated on signal' messages into pty.c where they
obviously should have been in the first place. Also there's been one
interesting repercussion in the terminal code: terminal.c's
from_backend now calls term_out() directly rather than expecting the
front end to call it afterwards. This has had the entertaining side
effect of fixing a Windows-specific bug whereby activity in a port
forwarding through a PuTTY with a blinking cursor caused the cursor
to blink to ON (!!!!). So, a surprisingly far-reaching checkin as it
turns out...

[originally from svn r3017]
2003-03-29 18:30:14 +00:00
Simon Tatham
d36a4c3685 Introduced wrapper macros snew(), snewn() and sresize() for the
malloc functions, which automatically cast to the same type they're
allocating the size of. Should prevent any future errors involving
mallocing the size of the wrong structure type, and will also make
life easier if we ever need to turn the PuTTY core code from real C
into C++-friendly C. I haven't touched the Mac frontend in this
checkin because I couldn't compile or test it.

[originally from svn r3014]
2003-03-29 16:14:26 +00:00
Simon Tatham
70729da988 Fix off-by-one in selection update while scrolling. Thanks Richard B.
[originally from svn r3013]
2003-03-29 13:54:11 +00:00
Ben Harris
1a27942544 DECCOLM fix, take 2. It turns out that my last fix wasn't causing crashes,
but PuTTY was running out of memory, which is both easy and fatal under Mac OS
at present.  Having fixed that, I've re-instated the screen-clearing and
cursor-homing on DECCOLM, and added resetting the scroll region, since this
seems to help VTL's keypad diagram display correctly.

[originally from svn r3006]
2003-03-27 00:22:59 +00:00
Ben Harris
1ef0684e82 Revert last change. It seems to cause crashes when DECCOLM actually changes
the width of the window.

[originally from svn r3003]
2003-03-26 23:13:41 +00:00
Ben Harris
94ecb07b60 DECCOLM should clear the screen and home the cursor, so it does now.
Correct interactions with DECOM and DECSTBM not investigated.
Should fix bug "deccolm-cls", but I'll leave it open till I've checked the
interactions.

[originally from svn r3001]
2003-03-26 21:14:39 +00:00
Simon Tatham
e9cc328501 Richard B's patch for resize behaviour. The scrollback now contains
a marker which defines everything before it as `permanent'
scrollback and everything after it as `temporary'; only temporary
scrollback lines are returned to the main screen when the window
height is increased. Screen clears mark the lines pushed into the
scrollback as permanent; so lines explicitly cleared off the screen
by ESC[2J are never returned to it by mistake. This patch also fixes
the incorrect state the primary screen is left in when the window is
resized while the alternate screen is active.

[originally from svn r2923]
2003-03-07 18:18:38 +00:00
Simon Tatham
c5181dc498 Richard B's patch to push erased text into the scrollback on ESC[2J
clears, and also to temporarily push the primary screen contents
into the scrollback while the alternate screen is active and bring
it back afterwards.

[originally from svn r2910]
2003-03-06 12:51:12 +00:00
Simon Tatham
bd16b29a7a Oops, Ben is quite right about the rather appalling design of
filename_from_str. Here's a better fix, with some const
repercussions too.

[originally from svn r2768]
2003-02-01 17:24:27 +00:00
Ben Harris
21275897d2 Make save_scroll() static.
[originally from svn r2766]
2003-02-01 15:42:01 +00:00
Simon Tatham
ccf35b8a26 Fix the gcc warnings in this module (since we now seem to be
building -Werror under Unix this is quite important!).

[originally from svn r2764]
2003-02-01 12:28:43 +00:00
Ben Harris
fe5f4c14f4 Richard's lazy-scrolling patch. This builds up scroll operations in a list,
combining adjacent ones for the same region, and runs them all in do_paint.
I'm not sure it's entirely right, but it works on my Mac in every case I've
tested.

[originally from svn r2763]
2003-02-01 12:26:33 +00:00
Simon Tatham
bcfa137c21 Yet more fallout from the 16-colour changes. I think by this time
these fiddly little changes are no longer bugs I introduced
recently, they're bugs that have been around all along and I've only
just smoked out by altering the ATTR_* definitions.

[originally from svn r2754]
2003-01-30 13:39:24 +00:00
Simon Tatham
09815b5050 Ahem, and restore the missing & from that checkin. Arrgh.
[originally from svn r2741]
2003-01-28 09:30:14 +00:00
Simon Tatham
54f033ace0 Oh, _that's_ why that `if' had the sense it did. Good grief.
Apparently I used to rely on the fact that the same `erase_char'
used to wipe parts of the screen was also a good value to use for
resetting line attributes. Should now be more robust against future
reorganisations of the ATTR_* bit fields.

[originally from svn r2740]
2003-01-28 09:26:32 +00:00
Ben Harris
28edf621aa Security fascists might claim that logging every keypress to stderr is a bad
idea, so stop doing that (only in the Mac port, so not actually much of a
problem).

[originally from svn r2737]
2003-01-28 00:17:17 +00:00
Simon Tatham
c370336a92 xterm apparently supports ESC[90m through ESC[97m to set bright
foreground colours, and ESC[100m through ESC[107m to set bright
background colours. Hence, so do we. Bright-foreground is
distinguishable from bold, and bright-background distinguishable
from blink, when it leaves terminal.c; the front end may then choose
to display them in the same way if it's configured to do so. This
change makes the xterm backend for Turbo Vision (!!!) work properly.
Untested on Mac.

[originally from svn r2734]
2003-01-27 23:03:31 +00:00
Simon Tatham
70f8e2cd74 Blinking text was broken on pterm. This should fix it.
[originally from svn r2732]
2003-01-27 15:44:48 +00:00
Ben Harris
de34bdac6d First attempt at a platform-independent keyboard handler. This isn't complete
yet -- there's no Alt+keypad support, and no way for the front-end to find
out what it should do with the Num Lock light.  It's also not fully tested.
Nonetheless, it's at least as good as the previous Mac keyboard handler.
Other platforms probably shouldn't adopt it just yet.

[originally from svn r2728]
2003-01-27 00:39:01 +00:00
Ben Harris
af4be2e83e Change the term_mouse interface a little so that it gets passed
both the raw and the cooked mouse button, with the mapping being done in
advance by the front-end.  This is useful because it allows the front-end to
use information other than the raw button (e.g. the modifier state) to decide
which cooked button to generate.
.
Front ends other than the Mac one are untested, but they just call
translate_button() themselves and pass the result to term_mouse().

[originally from svn r2721]
2003-01-25 16:16:45 +00:00
Ben Harris
694aafa071 Add the ability to close sessions. This adds *_free() functions to most
areas of the code.  Not all back-ends have been tested, but Telnet and SSH
behave reasonably.

Incidentally, almost all of this patch was written through Mac PuTTY,
admittedly over a Telnet connection.

[originally from svn r2615]
2003-01-15 23:30:21 +00:00
Simon Tatham
b2374a64fd Deglobalise the Unicode module. Despite all my grand plans, I've
just done this the very simple way - bundle all the globals into a
data structure and pass pointers around. One particularly ugly wart
is that wc_to_mb now takes a pointer to this structure as an
argument (optional, may be NULL, and unused in any Unicode layer
that's even marginally less of a mess than the Windows one). I do
need to do this properly at some point, but for now this should just
about be adequate. As usual, the Mac port has not been updated.

[originally from svn r2592]
2003-01-14 18:28:23 +00:00
Simon Tatham
10eb26a7dd term->cfg is now a full copy of the Config structure, not a pointer;
and term_reconfig() now passes in a new structure which is copied
over the top. This means that the old and new structures can be
compared, and the _current_ as well as default states of auto wrap
mode, DEC origin mode, BCE, blinking text and character classes can
be conveniently reconfigured in mid-session without requiring a
terminal reset.

[originally from svn r2557]
2003-01-12 14:30:02 +00:00
Simon Tatham
3d90359d10 We just got mailed a Dr Watson log which suggests I failed to
initialise term->paste_len during initialisation, and indeed looking
at the code confirms this. I'm puzzled as to why valgrind didn't
spot this in pterm, though, since it's all in cross-platform code!

[originally from svn r2494]
2003-01-08 09:15:56 +00:00
Simon Tatham
8de5682450 CJK cleanups. Correct handling when the cursor is covering the
right-hand half of a CJK wide character; correct handling of cut and
paste when CJK text wraps between lines _irrespective of the parity
of the starting column_; correct handling of wordness values
irrespective of which half of a CJK character the user
double-clicked on; correct handling when any terminal activity
overwrites only one half of a CJK wide character. I think we now
behave marginally better than xterm in this respect (it has a redraw
problem when you overwrite the RH half of a CJK char), so I'm happy.
Also redefined the internal UCSWIDE marker to something in the
surrogate range, while I'm here, so that U+303F is available for use
by actual users.

[originally from svn r2426]
2003-01-02 16:20:29 +00:00
Simon Tatham
241570c04f SCO ACS part 2 (ESC[12m) apparently puts the top half of CP437 into
_both_ halves of the character set, rather than flipping the two
halves. My source for this is linux/drivers/char/console.c.

[originally from svn r2394]
2002-12-31 11:03:23 +00:00
Ben Harris
873b95deff Put prototypes for the functions exported by wcwidth.c in putty.h, and remove
one from terminal.c.  Have wcwidth.c include putty.h to get its prototypes.

[originally from svn r2377]
2002-12-29 15:08:27 +00:00
Ben Harris
4345935c22 Make resizeline() and lineptr() static and give them prototypes.
[originally from svn r2376]
2002-12-29 14:47:01 +00:00
Simon Tatham
c583c6e85e Placate a trivial compiler warning.
[originally from svn r2347]
2002-12-18 11:51:09 +00:00
Ben Harris
12081087e7 Improve support for non-colour displays by adding a mask of attributes to
ignore when breaking text into runs for display, and implement setting this
on Mac (other ports just use 0xffffffff).

We don't use DeviceLoop for this any more because Apple Technical Q&A
QA1024 says we shouldn't.  Unlike their example, we don't depend on the
Display Manager's being present either.

[originally from svn r2264]
2002-11-29 00:32:03 +00:00
Ben Harris
19e1c15761 Fix a bug in scroll_display(): when the scrolled region contains the cursor
we need to update dispcurs as well as disptext.

Add scroll optimisation to scroll().  This makes it rather obvious that scroll
optimisation is breaking with PuTTY's usual policy of lazy updates, since
scrolling is done eagerly.  Fixing this so that all the scrolling is saved
up for do_paint would be nice, but non-trivial.

[originally from svn r2252]
2002-11-23 21:42:46 +00:00
Ben Harris
8280e645e4 Add a "Config *" argument to term_init(), and use that instead of the global
cfg throughout the terminal emulator.  Not tested in PuTTY and pterm, but they
just pass in &cfg.

[originally from svn r2248]
2002-11-23 19:01:01 +00:00
Ben Harris
03aa22be3c Bring in some of my scroll-optimisation stuff from the old Mac port.
This introduces a new front-end function, do_scroll(), which is expected to
scroll a part of the physical display and cause repaint events for any
areas that couldn't be scrolled (e.g. because they were hidden).
scroll_display() is a wrapper around this which also updates disptext to
match.

Currently, scroll_display is only used in response to user scrollback requests
(via term_scroll()), but extending scroll() to use it as well should be
easy.

All of this is conditional on the front end's defining OPTIMISE_SCROLL, since
only the Mac front end currently implements do_scroll().

[originally from svn r2242]
2002-11-23 13:07:29 +00:00
Ben Harris
b31bf55bc0 When processing input, refer to CR and LF as \015 and \012 respectively,
rather than \r and \n.  The latter tend to get swapped around by Mac C
compilers.

[originally from svn r2225]
2002-11-18 23:49:30 +00:00
Ben Harris
563eef2870 Change a temporary buffer from unsigned chars to chars, avoiding a pointer-cast
warning.

[originally from svn r2215]
2002-11-17 01:56:01 +00:00
Ben Harris
a12a78bcb9 Rename CharWidth() to char_width(). The former name clashes with an API
function in Mac OS.

[originally from svn r2205]
2002-11-09 21:46:21 +00:00
Simon Tatham
0720fc12ad terminal.c should call the frontend beep() routine even with
mode==BELL_VISUAL, otherwise taskbar flashing won't happen on visual
bells. It's up to the frontend routine to spot BELL_VISUAL and avoid
making any noise.

[originally from svn r2155]
2002-10-28 21:58:07 +00:00
Simon Tatham
ac545e0530 Another deglobalisation bug: failed to initialise term->curstype.
Thanks to valgrind for finding this one (aha! I knew there would be
benefits from doing a Unix port!).

[originally from svn r2152]
2002-10-28 17:30:47 +00:00
Simon Tatham
ea429ee71a Retire another global in favour of adding a feature to the
terminal.c interface.

[originally from svn r2148]
2002-10-26 14:06:52 +00:00
Simon Tatham
4756c15fc9 Yet more global-removal. The static variables in logging.c are now
absent, and also (I think) all the frontend request functions (such
as request_resize) take a context pointer, so that multiple windows
can be handled sensibly. I wouldn't swear to this, but I _think_
that only leaves the Unicode stuff as the last stubborn holdout.

[originally from svn r2147]
2002-10-26 12:58:13 +00:00
Simon Tatham
0b2523eeda Line discipline module now uses dynamically allocated data. Also
fixed one or two other minor problems.

[originally from svn r2141]
2002-10-26 10:16:19 +00:00
Simon Tatham
72ff571148 Major destabilisation, phase 2. This time it's the backends' turn:
each backend now stores all its internal variables in a big struct,
and each backend function gets a pointer to this struct passed to
it. This still isn't the end of the work - lots of subsidiary things
still use globals, notably all the cipher and compressor modules and
the X11 forwarding authentication stuff. But ssh.c itself has now
been transformed, and that was the really painful bit, so from here
on it all ought to be a sequence of much smaller and simpler pieces
of work.

[originally from svn r2127]
2002-10-25 11:30:33 +00:00
Simon Tatham
a9bd716df8 Cleanups from yesterday's destabilisation: lots of stuff in
terminal.c was apparently relying on implicit initialisation to
zero, and also I've removed the backends' dependency on terminal.h
by having terminal sizes explicitly passed in to back->size().

[originally from svn r2117]
2002-10-23 12:41:35 +00:00
Simon Tatham
0a80c983e2 Major destabilisation, phase 1. In this phase I've moved (I think)
all the global and function-static variables out of terminal.c into
a dynamically allocated data structure. Note that this does not yet
confer the ability to run more than one of them in the same process,
because other things (the line discipline, the back end) are still
global, and also in particular the address of the dynamically
allocated terminal-data structure is held in a global variable
`term'. But what I've got here represents a reasonable stopping
point at which to check things in. In _theory_ this should all still
work happily, on both Unix and Windows. In practice, who knows?

[originally from svn r2115]
2002-10-22 16:11:33 +00:00
Simon Tatham
bf0e8374f2 Thanks to Richard B for pointing out that xterm has its own variants
of the alternate-screen and save-cursor control sequences, with
subtly different semantics and entertaining interactions with the
usual ones. No thanks to xterm for doing so in the first place :-(
This checkin should sort it all out.

[originally from svn r2112]
2002-10-22 10:31:23 +00:00
Simon Tatham
07878d8b7c Implement Richard's really clever idea about bell overload mode:
it's automatically deactivated by any keypress, so that command-line
beeps from (e.g.) filename completion don't suddenly stop occurring,
but it still provides a rapid response to an accidental spewing of a
binary to your terminal.

[originally from svn r2107]
2002-10-20 13:23:30 +00:00
Simon Tatham
e30ab28d34 Oops - check in leftovers from yesterday's development. That's what
I get for running most of my cvs commands in the unix subdir :-/

[originally from svn r2078]
2002-10-16 09:28:17 +00:00
Simon Tatham
c01c1db847 Fixes to terminal.c to support blinking and visual bells under Unix.
[originally from svn r2068]
2002-10-15 16:40:22 +00:00
Simon Tatham
8bc305cafe Only engage a GTK idle function when absolutely necessary, otherwise
the whole app spins on it and takes up CPU all the time.

[originally from svn r2052]
2002-10-14 23:32:00 +00:00
Simon Tatham
ffff6f32c7 Selection now supported in pterm. Required small modifications
outside the unix subdir, owing to more things needing to become
platform-dependent.

[originally from svn r2033]
2002-10-13 11:24:25 +00:00
Simon Tatham
6d0e9b205d First phase of porting. pterm now compiles and runs under Linux+gtk.
The current pty.c backend is temporarily a loopback device for
terminal emulator testing, the display handling is only just enough
to show that terminal.c is functioning, the keyboard handling is
laughable, and most features are absent. Next step: bring output and
input up to a plausibly working state, and put a real pty on the
back to create a vaguely usable prototype. Oh, and a scrollbar would
be nice too.
In _theory_ the Windows builds should still work fine after this...

[originally from svn r2010]
2002-10-09 18:09:42 +00:00
Simon Tatham
64c52b0d30 Begin destabilisation in the wake of 0.53! This checkin contains the
beginning of a Unix port. It's nowhere near done, and currently it
won't even compile on Unix. But this represents the start of the
process of separating out platform-specific code, and also contains
the mkfiles.pl changes required to support a Unix makefile and a
non-flat source tree.

[originally from svn r1993]
2002-10-07 16:45:23 +00:00
Simon Tatham
ae476d5567 ANSI remote printer support. Raw mode only.
[originally from svn r1581]
2002-03-09 17:59:15 +00:00
Simon Tatham
fcb31d5cfe Well, there was bound to be one I'd forgotten: the new Features
panel should include an option to disable xterm mouse reporting. So
now it does. Woo.

[originally from svn r1579]
2002-03-09 11:47:39 +00:00
Simon Tatham
8c81f53a56 Oops. I wrote in the docs that no-remote-resize also included
no-remote-move-window, so I'd better live up to that...

[originally from svn r1577]
2002-03-06 23:06:07 +00:00
Simon Tatham
2df966b43c Add the Features panel, allowing you to disable a bunch of the more
controversial terminal features.

[originally from svn r1576]
2002-03-06 23:04:20 +00:00
Simon Tatham
d21683f92c The `wrapnext' flag should be saved and restored with the cursor
position. Failure to do this can give wrapnext==TRUE even with the
cursor not in the rightmost column.

[originally from svn r1572]
2002-03-02 17:37:48 +00:00
Simon Tatham
fdbd697801 from_backend() should always be called with len > 0. Only rlogin
mode ever failed to do this, and only Plink actually had a problem
with it, so this didn't become obvious for a while. rlogin mode is
fixed, and all implementations of from_backend() now contain an
assertion so that we should spot errors of this type more quickly in
future.

[originally from svn r1571]
2002-03-01 13:17:45 +00:00
Simon Tatham
349e2ce9e2 Patch from RDB: the ESC[8...t resize sequence and the ESC[18t size
report should both quote rows before columns, not vice versa.

[originally from svn r1534]
2002-01-08 09:56:31 +00:00
Simon Tatham
3ed0d44f16 Retired the #ifdef DUMP_PACKETS stuff in ssh.c because I'm utterly
sick of recompiling to enable packet dumps. SSH packet dumping is
now provided as a logging option, and dumps to putty.log like all
the other logging options. While I'm at it I cleaned up the format
so that packet types are translated into strings for easy browsing.
POSSIBLE SIDE EFFECT: in the course of this work I had to re-enable
the SSH1 packet length checks which it turns out hadn't actually
been active for some time, so it's possible things might break as a
result. If need be I can always disable those checks for the 0.52
release and think about it more carefully later.

[originally from svn r1493]
2001-12-14 14:57:50 +00:00
Simon Tatham
bb1f5cec31 Add support for most of the ESC[<low number>t sequences, which xterm
uses to manipulate the window (minimise, maximise, front, back,
move, resize) and report things about the window (is it minimised or
maximised, how big is it, what's its title). Missing are ESC[4;X;Yt
(resize to a specified pixel size; our resize code doesn't like it)
and ESC[19;X;Yt (report size of _screen_ in _characters_, which it
isn't even obvious how to do when you've got a variable font size).

[originally from svn r1414]
2001-11-25 15:21:25 +00:00
Simon Tatham
d2c9937691 Rectangular-block selection. Enabled by Alt+drag, unless you
configure it to be the default in which case it's _dis_abled by
Alt+drag.

[originally from svn r1350]
2001-10-31 18:50:09 +00:00
Simon Tatham
4badd37b4b Word-by-word (double-click) selection now spans line breaks if the
line break was created by wrapping. (Equivalently, if the selection
would _paste_ as a single word without a newline in the middle, then
it will _select_ in the same way.)

[originally from svn r1347]
2001-10-30 22:02:15 +00:00
Simon Tatham
9bbe53d700 Fix silly scrolling-vs-selection bug: if you selected text on line
9, then did ANSI Delete Line on line 10, the selection highlight
would move up a line even though it wasn't over any text that
actually moved. Easy to reproduce in the likes of vi. Trivial fix.

[originally from svn r1334]
2001-10-28 09:38:43 +00:00
Simon Tatham
cb102602a9 Better robustness in visual bell timeouts: handling GetTickCount
wraparound, not referencing vbell_timeout if in_vbell==FALSE, that
sort of thing. I doubt it'll fix the reported problems with screen
vbells, since none of the failure modes I've just prevented looked
all that probable to me, but it's nice to have extra robustness
anyway.

[originally from svn r1314]
2001-10-23 19:51:23 +00:00
Simon Tatham
7e1272bb53 D'oh, trivial typo which was completely breaking log-all-output.
[originally from svn r1308]
2001-10-12 21:39:16 +00:00
Simon Tatham
39c3f9b8bc Fix pasting of newlines in local line editing mode. Possibly not a
very _good_ fix; something might want doing after the release.

[originally from svn r1277]
2001-09-19 20:07:15 +00:00
Simon Tatham
6364ff3e71 terminal.c's from_backend() no longer calls term_out(), because
term_out() can in turn call ldisc_send() which calls back to
from_backend() when local echo is enabled. This was giving rise to
crazy re-entrancy stuff and stack overflows. Instead from_backend()
deposits its data in a bufchain which term_out() empties the next
time it's called.

[originally from svn r1276]
2001-09-18 19:41:07 +00:00
Simon Tatham
8c532d7668 Fix flaky scrollbar update when scrollback was reset to bottom.
[originally from svn r1275]
2001-09-18 19:04:21 +00:00
Simon Tatham
b4501dec57 Selection point movement on scroll should move selanchor as well as
selstart and selend, otherwise all those worthy ideals go *foom*
while the mouse buttons are held down.

[originally from svn r1274]
2001-09-18 18:59:37 +00:00
Simon Tatham
3d3ef9b8a4 Three more patches from RDB: one to make Atomica work right, one to
fiddle with the widths of characters in DBCS screen fonts, and (the
big one) one to enable a mode in which resizing the window locks the
terminal size and lets the font change, instead of vice versa. That
should shut up a few feature requests!

[originally from svn r1269]
2001-09-15 15:54:24 +00:00
Simon Tatham
6403725639 Scrollback viewing position, and selection endpoints, now keep pace
with the scrollback movement. (The former is of course only
detectable when reset-scrollback-on-activity is disabled.)

[originally from svn r1266]
2001-09-12 20:38:40 +00:00
Simon Tatham
d27684019b Roman Pompejus's patch (heavily hacked) for parametric log file
names with date, time and hostname automatically embedded.

[originally from svn r1255]
2001-09-09 09:58:20 +00:00
Simon Tatham
51eeeae237 Jan Holmen Holsten's patch for drag-selects to scroll the scrollback.
[originally from svn r1252]
2001-09-08 12:37:48 +00:00
Simon Tatham
e2c086b090 RDB's session logging patch: due to some ghastly special case, UTF-8
characters that failed the UTF-8 canonicality rules were being sent
to the session log twice. Sounds trivial, but I bet it'd have
confused anyone who turned on session logging precisely to track
down a canonicality bug :-)

[originally from svn r1244]
2001-09-07 22:51:52 +00:00
Simon Tatham
5fad95e748 Jacob's patch to cause Shift to return to copy-and-paste when xterm
mouse tracking is enabled. (This can be turned off if your app
really wants Shift+mouse, but it defaults to on for general
usefulness.)

[originally from svn r1235]
2001-09-07 20:35:38 +00:00
Simon Tatham
c87fa98d09 Extensive changes that _should_ fix the socket buffering problems,
by ceasing to listen on input channels if the corresponding output
channel isn't accepting data. Has had basic check-I-didn't-actually-
break-anything-too-badly testing, but hasn't been genuinely tested
in stress conditions (because concocting stress conditions is non-
trivial).

[originally from svn r1198]
2001-08-25 17:09:23 +00:00
Simon Tatham
48226525f7 Robert de Bath's implementation of ESC [ Z (backtab)
[originally from svn r1155]
2001-06-23 16:59:00 +00:00
Simon Tatham
9736adfcfa Oops - fixing the line-resizing segfault introduced a new
line-resizing segfault! Remind me to test under Minefield next time.
Should now be fine, as I've just done so.

[originally from svn r1141]
2001-05-21 13:33:12 +00:00
Simon Tatham
38b6d276d2 RDB: fix various UTF-8 glitches.
[originally from svn r1138]
2001-05-19 15:21:05 +00:00
Simon Tatham
26d63c3a96 SCO ACS patch from RDB. Apparently required for the Linux console
terminfo.

[originally from svn r1137]
2001-05-19 14:12:41 +00:00
Simon Tatham
b5a6c88da4 Fix from RDB: patch up mis-aimed fallthroughs in a terminal
emulation switch. (Bug was introduced in mouse reporting.)

[originally from svn r1134]
2001-05-19 11:34:20 +00:00
Simon Tatham
c1f41f9822 Terminal fix from RDB: probably didn't mean to compare a Y value
with a column count!

[originally from svn r1133]
2001-05-19 11:33:03 +00:00
Simon Tatham
df6c9ab083 Small terminal fix from RDB: CSI 1 K should erase the cursor
position itself, as well as everything to the left of it.

[originally from svn r1132]
2001-05-19 11:32:38 +00:00
Simon Tatham
079b6bc6f6 Reinstate the Shift-Ins paste behaviour, which was accidentally
broken by the mouse button redesignation that came with xterm mouse
reporting.

[originally from svn r1130]
2001-05-17 10:06:54 +00:00
Simon Tatham
aca29ffb7b Fix the line-resizing bug in scroll(). (Thanks to RDB for pointing
it out. A line was removed from the scrollback, cleared, and placed
at the bottom of the screen. Fine, except that the clearing process
assumed the line was the right length already, and thanks to lazy
resizing this wasn't necessarily the case. Segfaults and memory
corruption ensued.)

[originally from svn r1129]
2001-05-17 08:53:13 +00:00
Simon Tatham
8e5e0225e5 Scrollbar was failing to update when no scrollback-reset event had happened
[originally from svn r1126]
2001-05-14 13:31:14 +00:00
Simon Tatham
29cce22a90 Fix the sense of posdiff(), causing the extend-selection mouse
action to work correctly again.

[originally from svn r1125]
2001-05-13 16:13:39 +00:00
Simon Tatham
84e58edf9f Glenn Maynard's patch (as adapted by Jacob) for taskbar flashing
when a bell occurs and the window is minimised.

[originally from svn r1123]
2001-05-13 14:42:17 +00:00
Simon Tatham
fb473cc16c Placate gcc's `-Wall' warnings.
[originally from svn r1121]
2001-05-13 14:02:28 +00:00
Simon Tatham
26f1085038 RDB's Unicode patch. Fonts are now used in Unicode mode where
possible and we have a single unified means of trying to display any
Unicode code point. Instead of the various ad-hoc translation modes
we had before, we now have a single `codepage' option which allows
us to treat the incoming (and outgoing) text as any given character
set, and locally we map that to Unicode and back.

[originally from svn r1110]
2001-05-10 08:34:20 +00:00
Simon Tatham
7d86bbfbe2 From RDB: a few extra escape sequences seen in SCO terminals.
[originally from svn r1106]
2001-05-09 13:35:08 +00:00
Simon Tatham
9318b84598 Fix due to Robert de Bath: backspace should not cross line
boundaries when auto wrap is disabled.

[originally from svn r1101]
2001-05-09 12:48:01 +00:00
Simon Tatham
3730ada5ce Run entire source base through GNU indent to tidy up the varying
coding styles of the various contributors! Woohoo!

[originally from svn r1098]
2001-05-06 14:35:20 +00:00
Simon Tatham
93101b5a71 Wez Furlong's patch to add xterm mouse reporting and proper mouse
wheel support.

[originally from svn r1097]
2001-05-06 14:20:41 +00:00
Simon Tatham
059998d17b Remove diagnostics and attempt to work around VC compiler bug :-(
[originally from svn r1096]
2001-05-03 10:10:53 +00:00
Simon Tatham
56a5e6fdf3 Extra diagnostics in the hope that we can track down the problem with
the nightlies. I must remember to take it all out again when we do!

[originally from svn r1095]
2001-05-02 14:45:25 +00:00
Simon Tatham
321adcb4b9 The bell overload times are now measured in milliseconds, although
the config box still enters them in seconds (it allows fractions).

[originally from svn r1089]
2001-04-28 15:47:26 +00:00
Simon Tatham
296cad5962 Remove stray diagnostics. When will I learn?
[originally from svn r1088]
2001-04-28 15:33:48 +00:00
Simon Tatham
fc56312b45 Implement lazy horizontal resizing of screen and scrollback.
[originally from svn r1087]
2001-04-28 15:32:25 +00:00
Simon Tatham
9525da2826 Arrange that explicit visual bells performed using ESC[?5h and
ESC[?5l in immediate succession will still give a visibly long flash
of the screen.

[originally from svn r1086]
2001-04-28 14:39:16 +00:00
Simon Tatham
34d2d98bdd Two more small bugs introduced by the B-tree reorg: scroll() now
requires fix_cpos() to be called after it (otherwise cpos might point
to a line that isn't where you remember it being), and a mis-aimed
incpos() was causing forward selection dragging not to include the
char under the mouse. Both fixed.

[originally from svn r1063]
2001-04-17 09:25:52 +00:00
Simon Tatham
04b2c2b53e Fix alternate-screen bugs introduced by move to B-trees. Alternate
screen wasn't being correctly cleared on creation, and also wasn't
inhibiting scrollback like it should have.

[originally from svn r1061]
2001-04-17 08:53:31 +00:00
Simon Tatham
3abea3d4ea Having now compiled the last few days' changes with MSVC, it's turned
up a bunch of warnings, mostly unused variables. All fixed.

[originally from svn r1058]
2001-04-17 08:24:29 +00:00
Simon Tatham
559b00b90a Terminal now uses unsorted counted tree234 as its basic data type.
Should speed up scrollback to usable levels no matter how big your
scrollback buffer.

[originally from svn r1055]
2001-04-16 21:25:13 +00:00
Simon Tatham
f6ea0f9396 Oops - remove rogue debug messages!
[originally from svn r1040]
2001-04-13 11:01:56 +00:00
Simon Tatham
a8116a8dae New improved bell handling. Choice between visual and audible bell;
configurable bell overload handling. Thanks to Robert de Bath for
galvanising me into doing this, but I've had to rip most of his code
out and redo it myself...

[originally from svn r1039]
2001-04-13 10:52:36 +00:00
Simon Tatham
ac5bebc71d Jordan Russell's patch to match the PuTTY cursor blink rate to the
system-configured one.

[originally from svn r1036]
2001-04-11 10:03:46 +00:00
Simon Tatham
8e91c62bfa We can now configure the terminal's answerback string when it receives ^E.
[originally from svn r1031]
2001-04-09 12:43:46 +00:00
Simon Tatham
2c39b69a52 Default handling of VT100 line drawing characters in cut and paste is
now to translate them into poor man's characters (+--+ and |). We also
have an option to disable this (and map line drawing characters to the
corresponding ASCII code as before). Thanks to Robert de Bath.

[originally from svn r1029]
2001-04-09 11:59:35 +00:00
Simon Tatham
7a79df8fe6 Rethink the whole line discipline architecture. Instead of having
multiple switchable line disciplines, we now have a single unified
one which changes its behaviour based on option settings. Each
option setting can be suggested by the back end and/or the terminal
handler, and can be forcibly overridden by the configuration. Local
echo and local line editing are separate, independently switchable,
options.

[originally from svn r895]
2001-01-24 14:08:20 +00:00
Simon Tatham
d9de560388 The `wrapnext' variable now states whether we _would_ wrap next
character if we were wrapping, not whether we _will_ wrap next
character. Makes for saner behaviour with vertical-line cursor and
also when changing autowrap mode while on rightmost column. Does
entail small behavioural changes to backspace and destructive-
backspace when in rightmost column with Auto Wrap off, but I don't
think they should be catastrophic, or indeed that there's a well
defined Right Behaviour.

[originally from svn r872]
2001-01-17 17:25:58 +00:00
Simon Tatham
c68959b584 Introduce alternative cursor shapes: underline, vertical line
[originally from svn r870]
2001-01-17 16:57:33 +00:00
Simon Tatham
48b368d3ed Disable logging completely if the user selects Cancel when told the
file already exists

[originally from svn r851]
2001-01-08 16:24:13 +00:00
Simon Tatham
3a2a06b1fc Improved session logging courtesy of Roman Pompejus
[originally from svn r846]
2001-01-07 18:24:59 +00:00
Simon Tatham
d75f3687fb Correct pointer types in new clipme function
[originally from svn r812]
2000-11-24 22:27:51 +00:00
Simon Tatham
9147f68fb6 Ron Kuris's "copy everything to clipboard" patch
[originally from svn r808]
2000-11-21 19:28:25 +00:00
Simon Tatham
384eeb3f76 Fix miscellaneous compiler warnings. Thanks to Jacob Nevins
[originally from svn r755]
2000-10-24 10:47:49 +00:00