.. 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>
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>
I'm not 100% sure we really should even be doing this whole "keyboard"
open/close for termcap, but even if the right thing to do ends up being
to just do everything in the TTopen/TTclose (and make TTkopen/TTkclose
no-ops), it does seem to be the right thing to do.
Reported-by: Bijan Soleymani <bijan@psq.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It seems to have something to do with some old DOS mode, and not having
keyboard translation on ("Insert floppy A:" questions while opening
files? Whatever). But this is while doing normal file opens, and it is
just insane to open/close a tty across a file open.
The possible tty init/exit sequence would mess up some of the file
read/write messages.
Reported-by: Bijan Soleymani <bijan@psq.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The 'tcapkopen()' function re-initializes the terminal with the 'ti'
sequence, which for most sane termcap entries is just empty. But for
'xterm', that seems to actually be a real control sequence (clear and
reset?), and we'd better tell display.c that the screen is now garbage
and needs to be re-drawn.
Also, make tcapkclose() match the 'ti' (terminal init) with a 'te'
(terminal exit).
Maybe we should just stop playing games with ti/te, but this at least
improves the situation a bit.
Reported-by: Bijan Soleymani <bijan@psq.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
While I'm here, improve the word of the above two options.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
xmalloc checks the returned pointer and dies if it failed to allocate
the memory.
Use this new function in window.c.
More places will be converted to use xmalloc latter.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix the following warning:
input.c: In function ‘getstring’:
input.c:590: warning: ignoring return value of ‘mkstemp’, declared with attribute warn_unused_result
This add usage.c module for die function.
This also add wrapper.c module for the xmkstemp that is wrapper function
around the original mkstemp function.
Both module codes was largelly based on git, linux and sparse codes.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This constant is used only there, so there is no reason for it to be
in estruct.h
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
These two constants are only needed/used by the posix.c file,
so just define them there.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This fix the following warning:
buffer.c: In function ‘nextbuffer’:
buffer.c:45: warning: ‘bp’ may be used uninitialized in this function
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I got following errors while compiling uemacs:
names.c:132: error: ‘insspace’ undeclared here (not in a function)
names.c:217: error: ‘yank’ undeclared here (not in a function)
make: *** [names.o] Error 1
It looks like names.c needs line.h for function declarations.
Signed-off-by: Li Jie <eltshanli@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This constant is only used in line.c. So just keep it there.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 is not a subprogram and doesn't seem it will be, so there is no reason
to leave this macro. And this macro is defined to 0, so we never reach the path
where we test for this macro.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The implementation of these functions are doing anything at all at this moment.
So cleanup a bit the code by removing fnclabel and spal functions completly.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch removes bunch of ancient Makefiles and VMS scripts from
uemacs source tree. If somebody really needs them, they can always look
them up from git repository history.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch fixes Makefile 'clean' target to clean up program executable 'em'.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
This patch kills an unused 'lckhello' function and gets rid of the following
GCC warning:
CC lock.o
lock.c:160: warning: ‘lckhello’ defined but not used
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This type is already exported in edef.h
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Added + and +<n> to the usage output.
Also fixed the following warning:
main.c: In function ‘main’:
main.c:121: warning: ‘gline’ may be used uninitialized in this function
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This functions is only used internally by basic.c, so marking it static,
to make it private.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch fixes out-of-box build on Mac OS X by using "uname -s" to detect the
underlying OS and fixing up defines accordingly.
Cc: Yong Luk Stanley Elijah Goh <stan@t0xt.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Compiles on Mac OS X 10.6.4.
setmode() is renamed to setemode() to avoid conflict with OS X's unistd.h's
setmode().
Modify Makefile to enable the appropriate DEFINES to compile on Mac OS X.
Signed-off-by: Yong Luk Stanley Elijah Goh <stan@t0xt.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
There is a case when the user can type something like this:
em filename +
or even
em +
Instead of saying "Bogus argument" when the uemacs start, just go to the end of
the buffer like we can do in vim for example.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
Replace four macros used to define integer constants with a enum.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>