aboutsummaryrefslogtreecommitdiff
path: root/display.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Avoid memory access errors if llength() overflowsLinus Torvalds2013-02-221-1/+1
| | | | | | | | | | llength() is currently a 'short' which can overflow and result in signed numbers if line lengths are larger than 32k. We'll fix the overflow separately, but before we do that, just use a signed int to hold the value so that we don't overrun memory allocations when we converted that negative number to a large positive unsigned integer. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Fix vtputc() and simplify show_line by using it againLinus Torvalds2012-07-111-24/+10
| | | | | | | | | | | | | This re-introduces vtputc() as the way to show characters, which reinstates the control character handing, and simplifies show_line() in the process. vtputc now takes an "int" that is either a unicode character or a signed char (so negative values in the range [-1, -128] are considered to be the same as [128, 255]). This allows us to use it regardless of what the source of data is. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Make 'show_line()' do proper TAB handlingLinus Torvalds2012-07-111-4/+17
| | | | | | | | | The TAB handling got broken by commit cee00b0efb86 ("Show UTF-8 input as UTF-8 output") when it stopped doing things one byte at a time. I'm sure the other special character cases are broken too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Make cursor movement (largely) understand UTF-8 character boundariesLinus Torvalds2012-07-101-6/+5
| | | | | | | | | | Ok, so it may do odd things if it's not truly utf-8, and when moving up and down lines that have utf-8 the cursor moves oddly (because the byte offset within the line stays constant, rather than the character offset), but with this you can actually open the UTF8 example file and move around it, and at least some of the movement makes sense. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Split up the utf8 helper functions into a file of their ownLinus Torvalds2012-07-101-46/+1
| | | | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Show UTF-8 input as UTF-8 outputLinus Torvalds2012-07-101-3/+59
| | | | | | | | | | | | | | | | | | | | | | | | .. by doing the stupid "convert to unicode value and back" model. This actually populates the 'struct video' array with the unicode values, so UTF8 input actually shows correctly. In particular, the nice test-file (UTF-8-demo.txt) shows up not as garbage, but as the UTF-8 it is. HOWEVER! Since the *editing* doesn't know about UTF-8, and considers it just a stream of bytes, the end result is not actually a usable utf-8 editor. So don't get too excited yet: this is just a partial step to "actually edit utf8 data" NOTE NOTE NOTE! If the character buffer contains Latin1, we will transform that Latin1 to unicode, and then output it as UTF8. And we will edit it correctly as the character-by-character data. Also, we still do the "UTF8 to Latin1" translation on *input*, so with this commit we can actually continue to *edit* Latin1 text. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Make the 'struct video' contain an array of unicode characters rather than bytesLinus Torvalds2012-07-101-20/+22
| | | | | | | | | | | | | | | | | | This is disgusting. And quite frankly, it's debatable whether this will ever work. The "line" structure is still just an array of characters, so that has to work with utf-8. But the 'struct video' thing is what represents the actual screen rectangle, and is fixed-size by the size of the screen. So making it contain actual 32-bit unicode characters *may* make sense. Right now we translate things the same way we always used to, though, so utf-8 in 'struct line' will not be translated to the proper unicode array, but to the bytes of the utf-8 representation. So this really doesn't improve anything per se yet, just expands the memory use of the video array. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Show lines with a single helper function, not one byte at a timeLinus Torvalds2012-07-101-12/+12
| | | | | | Let's see how hard it is to show UTF-8 characters properly. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Show xA0 (nbsp) as a non-printable characterLinus Torvalds2011-08-221-1/+1
| | | | | | | | I want to see the difference between space and nbsp, and I consider nbsp to be a control character, so show it as such. Even if it is technically "printable". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: display.c: Use the newly introduced xmalloc function.Thiago Farina2010-12-161-19/+5
| | | | | Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: Move structure line and its functions to its own header file.Thiago Farina2010-11-151-5/+7
| | | | | Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: Kill dead codePekka Enberg2010-11-141-22/+0
| | | | | | | This patch kills #ifdef'd code from display.c and file.c. Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: Fix return statementsPekka Enberg2010-08-291-17/+17
| | | | | | | | Return statement is not a function so remove superfluous use of parenthesis. Cc: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: Add --help option.Thiago Farina2010-08-181-9/+10
| | | | | | | Add a basic usage() function to support the --help option. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: convert typedef struct window_t to struct window.Thiago Farina2010-08-011-14/+14
| | | | | Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: convert typdef struct VIDEO to struct video.Thiago Farina2010-06-011-21/+21
| | | | | Signed-off-by: Thiago Farina <thiago.farina@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: convert typdef struct LINE to struct line.Thiago Farina2010-04-281-8/+8
| | | | | | Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: remove use of 'register' keywordPekka Enberg2010-02-271-53/+53
| | | | | | | | | | | | | Lets welcome uEmacs/PK to the year 2010! As expected, the patch has no effect on the generated code: text data bss dec hex filename 106002 8864 18616 133482 2096a em 106002 8864 18616 133482 2096a em.new Cc: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: remove typdef struct BUFFER -> struct buffer.Thiago Farina2010-02-151-1/+1
| | | | | Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uemacs: fix sparse warnings, making file-local symbols static.Thiago Farina2010-01-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ansi.c:255:6: warning: symbol 'ansihello' was not declared. Should it be static? epath.h:11:6: warning: symbol 'pathname' was not declared. Should it be static? display.c:36:7: warning: symbol 'vscreen' was not declared. Should it be static? display.c:38:7: warning: symbol 'pscreen' was not declared. Should it be static? display.c:927:5: warning: symbol 'updateline' was not declared. Should it be static? evar.h:20:6: warning: symbol 'uv' was not declared. Should it be static? evar.h:24:6: warning: symbol 'envars' was not declared. Should it be static? evar.h:128:7: warning: symbol 'funcs' was not declared. Should it be static? fileio.c:14:6: warning: symbol 'ffp' was not declared. Should it be static? fileio.c:15:5: warning: symbol 'eofflag' was not declared. Should it be static? ibmpc.c:505:6: warning: symbol 'ibmhello' was not declared. Should it be static? isearch.c:36:5: warning: symbol 'saved_get_char' was not declared. Should it be static? isearch.c:37:5: warning: symbol 'eaten_char' was not declared. Should it be static? isearch.c:41:5: warning: symbol 'cmd_buff' was not declared. Should it be static? isearch.c:42:5: warning: symbol 'cmd_offset' was not declared. Should it be static? isearch.c:43:5: warning: symbol 'cmd_reexecute' was not declared. Should it be static? line.c:21:6: warning: symbol 'ykbuf' was not declared. Should it be static? line.c:22:5: warning: symbol 'ykboff' was not declared. Should it be static? lock.c:17:6: warning: symbol 'lname' was not declared. Should it be static? lock.c:18:5: warning: symbol 'numlocks' was not declared. Should it be static? vmsvt.c:521:6: warning: symbol 'hellovms' was not declared. Should it be static? vt52.c:181:6: warning: symbol 'vt52hello' was not declared. Should it be static? Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Mark functions and variables local to display.c 'static'Linus Torvalds2006-11-191-43/+52
| | | | | | | Waste a few minutes occasionally on cleanup, and maybe we can make this thing look ok in a decade or two.. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Handle 8-bit characters better in displayLinus Torvalds2005-10-011-14/+35
| | | | | | | This code still assumes a latin1 kind of "one byte, one character" setup. UTF-8 input/output (even if the data is encoded in latin-1) is a separate issue.
* Make sources mostly sparse-cleanLinus Torvalds2005-10-011-1/+0
| | | | | Mainly an issue of taking care of a few remaining K&R function declarations.
* Fix more compiler warningsLinus Torvalds2005-10-011-0/+1
| | | | Better initializers, and more proper function types.
* Replace "WINDOW" type with "window_t"Linus Torvalds2005-10-011-10/+10
| | | | Starting to try to avoid name clashes with curses and friends.
* Lots of ANSI'fication and cleanupsLinus Torvalds2005-09-301-0/+1
| | | | | | Still tons of warnings with "-Wall", but now it's actually getting closer. It even compiles again.
* First cut at turning things into proper modern ANSI CLinus Torvalds2005-09-301-142/+137
| | | | Hey! Real declarations!
* Fix up headers and bogus re-definitions to use <stdlib.h> and <string.h>Linus Torvalds2005-09-301-1/+0
| | | | | Hey, it's already compiling cleaner. Getting proper function declarations will be a bitch, though.
* Run "indent -kr -i8" on the sourcesLinus Torvalds2005-09-301-526/+504
| | | | Let's see how nasty it is to clean things up. For real.
* Minimal patches to make uemacs compile in a modern environment.Linus Torvalds2005-05-311-0/+1
| | | | | | make sure to include <errno.h>, and allow for the fact that newer gcc's don't allow function declarations in function scope (don't ask me why, but there you have it..)
* Initial import of em-4.0.15-ltLinus Torvalds2005-05-311-0/+1570
This is a slightly updated version of uemacs-PK (PK is Pekka Kutvonen) which was used at Helsinki University a long time ago. My fingers cannot be retrained.