Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
next_printf() shouldn't return null unless it never found the start of an
escape sequence (it'll return a pointer to the null at the end of the string
otherwise), and the only time we point it at a % and it doesn't is when it's
%%. So handle that before calling. (Also, a single trailing % prints in
other implementations, and while I'm there update to use FLAG() macros,
add a couple comments, and only xflush() once per pattern.)
|
|
When the specified format string has odd '%' in the end,
the next_printf function will return null. Checking
the result value before using it.
Signed-off-by: liwugang <liwugang@xiaomi.com>
|
|
|
|
Reimplemented basic cursor movements and char delete.
In order to work more correctly with utf-8 data.
x,h,j,k,l seems to work now with test data such as
tests/files/utf8/test2.txt
hjkl now accept count parameter so 1000j will scroll file 1000 lines
relative move to bottom
word movements w,e,b... still need to be still reimplemented in order to
step correctly on utf-8 data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Style cleanups:
Removing whitespaces at end of lines, hopefully reduces git am
warnings
Bug fixes:
fix segfault if file did not exist, now creates one empty line
fix insert mode text not showing on start of line
fix append on empty line
fix cursor move right on empty line
|
|
Now calculates utf-8 rune width properly before trying to print on screen.
works with test1.txt and test2.txt on tests/files/utf8 folder with
0x0300-0x036F combining chars
Uses mbtowc and wcwidth to calculate width of rune. These both should be
implemented on c runtime that conforms POSIX-1.2001. Different c
runtimes might have different level of support to combining char
ranges etc...
I think there is no standard way to calculate utf-8 rune width without
converting it first to widechar. And i think conversion to widechar just
to calculate width is silly, since all write calls can be done with utf8
directly (on utf8 locales ofc), but in order to calculate them yourself
without pointless conversion, one would need to write variable byte lookup
array for binary searching weird ranges and make sure it works with big-endian
systems too...
By the way running ./watch ./cat tests/files/utf8/japan.txt does not print the
text for some reason, but other test data does... I was checking how
well original crunch_str works and noticed it.
-Jarno
|
|
|
|
|
|
implement deferred utime updates (so directory timestamps correct).
|
|
|
|
and fix tests to pass on host too.
|
|
BcVec contains the null at the end, so v->len is greater than
strlen(v->v) by one.
|
|
Gentoo removes verbosely when building packages, for example vim-core:
https://github.com/gentoo/gentoo/blob/665eaa8/app-editors/vim-core/vim-core-8.1.0648.ebuild#L120
Implement like toy cp, without prepending an escape sign to quotation
marks in filenames. Document in a test this difference from coreutils
but similarity to busybox. How do other implementations handle such
escapes? If it matters, would you approach it with a loop and multiple
prints or somehow else?
Short help description follows 141a075, consistent with other commands.
|
|
The return value of -exec was the command's exit code, which did not
account for the fact that an exit code of zero means success, while in
C, zero means failure. From POSIX:
> the primary shall evaluate as true if the utility returns a zero
> value as exit status
This commit flips the return value, and adds two tests.
|
|
|
|
Variable initialization to start of blocks
Space after if,for,while: if() -> if ()
Space after comma on function calls:
write(fd,buf,count); -> write(fd, buf, count);
Spaces surrounding variable initialization
Pointer * binding to variable instead of type: int* i -> int *i
Spaces surrounding compare operators
No spaces surrounding arimetic operators
Some aligntment whitespace fixes
Still messy and needs more cleanup, but there is bigger issues to solve
first.
|
|
Removed for(int i = 0;....) style loop initializers to be consistant
with project style.
Removed few unused global variables
Added 2 empty white space lines back to CONFIG comment section.
|
|
Has beginnings of reading file, saving file, hjkl movement, insert, ex
(only w, wq, q!), search with /, some other normal mode actions (dd, w, b,
e), some utf8 support
Everything is still very unfinished and partly behaves wrongly comparing
to original vi. But simple tasks like modifying short config files
should be possible.
Some things like draw_page needs serious refactor since it now writes
whole screen after every keypress. Didint bother to refactor yet if
linked list needs to be replaced with something else...
|
|
|
|
Two "is never used uninitialized" and one "we don't trust you to get clearly
documented operator precedence right". (The compiler may not "suggest".
Every time I go "abc && def || exit 1" in the shell it means I know the
operator precedence _and_ the short-circuit rules, which are the same as
C here. This is a warning aimed at C++ developers, it should not be enabled
for C.)
|
|
|
|
|
|
|
|
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
|
|
|
|
This one with a little cleanup of unnecessary duplication.
|
|
|
|
|
|
|
|
|
|
Also add a test, and add a test for timeout now it's been fixed.
|
|
|
|
|
|
Sunday's transition in the US broke a bunch of the tests. Worse, it
broke some of the QA folks' scripts. Finally, the boil that is date's
handling of time zones and daylight time has come to a head...
This patch fixes the newly-failing tests *and* the other tests that were
checked in failing to serve as TODOs.
I've resolved the test TODOs about whether implied year/century in POSIX
format should mean the current year or 1900 in favor of the current
year. Both busybox and coreutils agree, and Rob fixed the code recently
so toybox agrees too, but without fixing the tests.
I've switched tests from Europe/London to Europe/Berlin to avoid
disagreements between C libraries about whether to say "GMT" or "UTC"
when daylight savings is not in force.
The majority of this patch implements what I'd been unsuccessfully
trying to explain on the list: that to correctly implement the distinct
input and output time zones (as demonstrated in the three failing tests
we've been carrying around for a while), we should switch to working
with time_t internally rather than struct tm. I've also added the code
to temporarily switch to the input time zone (and back again).
All the tests now pass.
|
|
|