Commit Graph

183 Commits

Author SHA1 Message Date
Přemysl Eric Janouch fbfd8c7d02
tabfile: add support for writing Pango markup
Enabling this option will ensure the field would parse.
2021-10-10 01:52:15 +02:00
Přemysl Eric Janouch 20fcf2a0c7
tabfile: make it possible to set metadata
And some related clean-up.
2021-10-07 16:28:44 +02:00
Přemysl Eric Janouch 3881725904
tabfile: remember to check UTF-8, glibize 2021-10-06 22:11:21 +02:00
Přemysl Eric Janouch 6c364dc997
Add an implementation of tabfile
The original one is a horrible thing.  Now we're self-reliant.
2021-10-06 22:04:55 +02:00
Přemysl Eric Janouch 690402f2e1
Unbreak stardict_dict_get_synonyms()
Untested, but certainly broken six ways to Sunday before.
2021-10-06 20:14:49 +02:00
Přemysl Eric Janouch 03f2123447
GLib-related improvements
Now all error messages produced by tools should be in the right
encoding, even if the system isn't in UTF-8.
2021-10-06 16:11:55 +02:00
Přemysl Eric Janouch 3c87b95c31
Make Tab put the current definition into search
Moving some X11-only code out.
2021-10-06 13:44:54 +02:00
Přemysl Eric Janouch 2b5eb86a9f
sdtui: enable styling of defocused selected rows
The defaults are unaffected, the row is always reverse, like it used to.

Having the deselected row just be underlined seems sensible.

It isn't currently possible to change /just/ the foreground or
the background colour of the selection, due to how ncurses works
with colours.

Bumped termo to enable requesting the appropriate events.
2021-07-03 11:44:01 +02:00
Přemysl Eric Janouch 85ca0c5857
sdtui: normalize whitespace in clipboard input 2021-07-03 11:36:46 +02:00
Přemysl Eric Janouch e47667b28a
sdgtk: don't follow our own selection
When the main window is focused, we are probably the owner of it.
2020-09-14 02:02:38 +02:00
Přemysl Eric Janouch aa19848499
Add an experimental GTK+ UI
It has a potential to stay simpler than the TUI,
while having a wider feature set.

Not building this toy by default, it needs some time investment.
2020-09-08 05:02:14 +02:00
Přemysl Eric Janouch 588b6ef8bb
Fix a segfault when search goes past the end
Removing a preprocessor macro in favor of a normal function.
2020-09-08 05:01:31 +02:00
Přemysl Eric Janouch fda956093c
Update copyright years within the program 2020-09-07 19:05:16 +02:00
Přemysl Eric Janouch 695f71d946
tools: clean up error message printing 2020-09-04 00:13:34 +02:00
Přemysl Eric Janouch 8d19acd91a
Add a tool to transform dictionaries 2020-09-04 00:13:34 +02:00
Přemysl Eric Janouch dd2bd04a07
Fix a typo 2020-09-03 23:15:59 +02:00
Přemysl Eric Janouch bbe22712fe
Enable switching among more than 10 dictionaries
Ctrl + PageUp/PageDown/Left/Right now change the active tab.
2020-09-02 16:29:59 +02:00
Přemysl Eric Janouch 37bf8ee648
Name change 2020-09-02 16:27:45 +02:00
Přemysl Eric Janouch 1289c98ca8
Bump to GLib 2.38 because of deprecation warnings 2020-04-15 07:00:36 +02:00
Přemysl Eric Janouch fcc0c3ef2d
Fix an unimportant memory leak 2018-09-23 11:45:23 +02:00
Přemysl Eric Janouch 2efaed1a56
Implement the INCR ICCCM selection mechanism
xcb_get_property is now also called with a length that is a multiple
of four so that we advance the offset properly.

Some cleanup.

Selection code should work pretty well by now.  The amount of code
supporting it has more than doubled since GTK+.
2018-09-23 11:45:13 +02:00
Přemysl Eric Janouch 86417d512b
Re-shuffle code, no functional changes 2018-09-23 06:38:03 +02:00
Přemysl Eric Janouch 942bda7db4
Use XCB and SelectSelectionInput instead of GTK+
As it happens, there is no real need to constantly poll for changes,
since XFixes can inform us of updates as they happen.

With GTK+ gone we've got dependencies and error handling under control.
XCB is a truly awful thing to learn, though.

Our method will never work on Wayland or Windows, so we don't miss out
on anything by abandoning the huge toolkit.
2018-09-23 06:38:03 +02:00
Přemysl Eric Janouch b0d3b2dcb5
Strip whitespace from clipboard contents 2018-06-30 13:23:30 +02:00
Přemysl Eric Janouch e5faed57c2
Relicense to 0BSD, update mail address
I've come to the conclusion that copyright mostly just stands in the way
of software development.  In my jurisdiction I cannot give up my own
copyright and 0BSD seems to be the closest thing to public domain.

The updated mail address, also used in my author/committer lines,
is shorter and looks nicer.  People rarely interact anyway.
2018-06-24 05:23:31 +02:00
Přemysl Eric Janouch 80306c5779
Skip combining marks in the editor
For slightly more correct Unicode handling.
2017-06-27 20:03:38 +02:00
Přemysl Eric Janouch 3067e15929
Fix and update LICENSE 2017-02-03 23:14:34 +01:00
Přemysl Eric Janouch 2357b67f23
Make prefix matching behave better
It seems to me that we _do_ want to ignore diacritics most of the time.

I've also fixed the fallback.
2016-10-23 00:33:30 +02:00
Přemysl Eric Janouch 77918d8a8c
Fix some character width counting 2016-10-22 23:38:00 +02:00
Přemysl Eric Janouch fc395d4068
Fix mouse clicks on full width characters 2016-10-22 23:29:29 +02:00
Přemysl Eric Janouch 6155c9bf91
Try to make the view full 2016-10-22 23:10:58 +02:00
Přemysl Eric Janouch dcfc9bfd22
Disallow scrolling down too much
The ability to scroll past the end was rather unusual.

You can still achieve that by searching and resizing the window now.
2016-10-18 20:46:51 +02:00
Přemysl Eric Janouch e06d9c9f71
Tiny enhancements and cleanups 2016-10-18 20:46:38 +02:00
Přemysl Eric Janouch 6f91f8131a
Microoptimization
It hurts me to see wasted mallocs.
2016-10-18 19:06:51 +02:00
Přemysl Eric Janouch a63db9d978
Fix regression in GLib message handler 2016-10-12 22:21:15 +02:00
Přemysl Eric Janouch 1f811d903e
Don't increment the result from GUINT_TO_POINTER
Increment the argument instead.
2016-10-08 09:21:54 +02:00
Přemysl Eric Janouch a7068157f2
Parallelize dictionary loading
It gives me about 2.5 times speed-up on a 4-core CPU.

It could be even better and I mainly blame GLib.
2016-10-08 03:39:06 +02:00
Přemysl Eric Janouch 26155227c7
Simplify the collation mess
Brings a bit worse performance on load since more memory is being
reordered but it seems to be worth it.
2016-10-08 01:20:09 +02:00
Přemysl Eric Janouch 36236955e5
Simplify, optimize terminal output
Finally getting rid off app_add_utf8_string().

Just like in nncmpp, the dependency on ncurses is now a bit narrower.
2016-10-07 18:35:27 +02:00
Přemysl Eric Janouch 0d779d718b
Improve memory usage
By avoiding unnecessary fragmentation in indexes.

With a larger set of dictionaries, I've observed a ~20% improvement.
2016-10-07 17:30:57 +02:00
Přemysl Eric Janouch 930ce8a944
Fix regression in locale support 2016-10-07 17:26:56 +02:00
Přemysl Eric Janouch 3c5eae978d
Update more copyright years 2016-09-28 16:25:19 +02:00
Přemysl Eric Janouch ee37895206
Update documentation 2016-09-28 16:11:56 +02:00
Přemysl Eric Janouch 38b463c883
Move the -w switch to the configuration file
Update README accordingly.

Woo, I get to remove code.
2016-09-28 06:01:13 +02:00
Přemysl Eric Janouch b3458d84a0
Handle mouse clicks on dictionary names 2016-09-28 05:27:53 +02:00
Přemysl Eric Janouch 1f60d096ea
Fix mouse in the search bar 2016-09-28 05:27:22 +02:00
Přemysl Eric Janouch 30345ec8d4
Show all dictionaries in the header
Make the style of the active dictionary's name configurable.
2016-09-28 05:05:24 +02:00
Přemysl Eric Janouch 4f0a47d5f7
Allow loading multiple dictionaries
They can also be specified in the configuration.

They can be switched between using Alt+<number>.
2016-09-28 04:30:15 +02:00
Přemysl Eric Janouch a063328ac8
Fix performance regression
Avoid stepping through the entire dictionary

When looking for the first match with an empty common prefix.
2016-09-28 04:17:08 +02:00
Přemysl Eric Janouch f453b9dd43
Extract get_xdg_config_dirs() 2016-09-28 04:16:00 +02:00
Přemysl Eric Janouch 021fdcc97c
Use GLib booleans 2016-09-28 03:05:39 +02:00
Přemysl Eric Janouch ff0ec60931
Validate encoding in .ifo files 2016-09-28 03:03:42 +02:00
Přemysl Eric Janouch 474bcb518a
Make app_load_config() return any error 2016-09-28 00:14:11 +02:00
Přemysl Eric Janouch db0579b7a0
Improve partial matches 2016-09-27 03:47:36 +02:00
Přemysl Eric Janouch da6c46cba9
Fix common prefix search with no collator 2016-09-27 03:35:14 +02:00
Přemysl Eric Janouch 08fdad56eb
Fix Travis build 2016-09-26 21:14:13 +02:00
Přemysl Eric Janouch 5ee562faf4
Make it possible to disable prefix highlighting 2016-09-26 21:06:51 +02:00
Přemysl Eric Janouch 81d702ed66
Add a configuration file
Now you can have pretty colors w/o having to hardcode them.
The selection is rather limited for now, though.

Search "centering" can now be disabled by default as well.
2016-09-26 21:06:51 +02:00
Přemysl Eric Janouch 4755033781
Fix bottom right corner 2016-09-26 20:50:38 +02:00
Přemysl Eric Janouch a591041912
Highlight the longest matching prefix of entries 2016-09-26 15:59:26 +02:00
Přemysl Eric Janouch a87aca9c76
Refactor app_add_utf8_string() 2016-09-26 14:14:01 +02:00
Přemysl Eric Janouch f1624095f8
Update copyright years 2016-09-25 22:24:35 +02:00
Přemysl Eric Janouch 61f8b134a9 Fix transcoding on OpenBSD 2016-01-14 22:52:46 +01:00
Přemysl Eric Janouch e740854dd2 Center the view on search
A lot of the time a better match is actually before the point
where we expect the entry to be.

Can be turned off with Alt-C.
2015-07-25 17:01:42 +02:00
Přemysl Eric Janouch 1b15b52087 Formatting: leftovers 2015-02-28 21:21:21 +01:00
Přemysl Eric Janouch 25366d369b Refactoring 2015-02-27 23:50:32 +01:00
Přemysl Eric Janouch 6fb83a4043 Don't let GLib/GTK+ draw messages over curses 2015-02-27 23:42:24 +01:00
Přemysl Eric Janouch 7db828f62b Handle SIGINT/SIGTERM properly 2015-02-27 23:36:56 +01:00
Přemysl Eric Janouch 10240c716a Formatting 2015-02-26 23:29:45 +01:00
Přemysl Eric Janouch 2f0852ec05 Handle search field overflow a bit better
Make sure the cursor doesn't overflow where it doesn't belong.
2015-02-24 23:52:36 +01:00
Přemysl Eric Janouch f4b29a980c Add a near-useless bar on top with bookname 2015-02-24 23:42:15 +01:00
Přemysl Eric Janouch 9f8af6c27b Fix build with ICU versions < 50
I'll try to describe my feelings with this excerpt from
David Firth's video "Take This Pill":

  PAIN.

  *oooowww...*

  Hurts, doesn't it?

  *...wwwwwww*
2015-02-24 21:39:45 +01:00
Přemysl Eric Janouch ccfa92ba2a Fix reporting of unknown .ifo keys 2015-02-24 09:27:38 +01:00
Přemysl Eric Janouch 2abbe7017f Add a custom collation mechanism
A lot better than that StarDict shitfuckery.
2015-02-24 09:27:38 +01:00
Přemysl Eric Janouch d93b241a65 Silence a warning
We don't care if we read a byte from the pipe.
2015-02-14 06:16:17 +01:00
Přemysl Eric Janouch 61ad99b611 Make more use of xstrtoul() 2015-02-07 22:11:53 +01:00
Přemysl Eric Janouch 99116d0f70 Update information texts and copyrights 2015-02-07 21:38:27 +01:00
Přemysl Eric Janouch e1643289c5 Cancel selection confirmation when following the selection 2015-02-07 21:13:34 +01:00
Přemysl Eric Janouch a9bc1d8751 Add support for watching the primary selection
Depends on GTK+, which should make it work with all of X11, Wayland, and Mir.
2015-02-07 21:05:32 +01:00
Přemysl Eric Janouch 627248bd1f React to mouse wheel scrolling 2015-02-07 20:36:45 +01:00
Přemysl Eric Janouch 4730cc47e1 Hide the help in app_search_for_entry() 2015-02-07 20:35:09 +01:00
Přemysl Eric Janouch 6e42b07d20 Or let's rather do it like this 2015-02-01 22:44:16 +01:00
Přemysl Eric Janouch 08ed996fe1 Tell termo to convert DEL to Backspace
Now backspace works in tmux.
2015-02-01 22:32:49 +01:00
Přemysl Eric Janouch bb9802f83d resize_term -> resizeterm
Apparently we do need to call the "outer-level" function.
2015-01-20 23:56:29 +01:00
Přemysl Eric Janouch a5e0c0ea71 Update termo 2014-11-19 03:31:47 +01:00
Přemysl Eric Janouch 2562d108fa Avoid some overhead with iconv()
Now, in theory, terminal output could actually be a bit faster.
2014-11-19 03:31:47 +01:00
Přemysl Eric Janouch da3a4842f1 Get rid of wchar_t for good 2014-11-19 03:31:47 +01:00
Přemysl Eric Janouch b8dc6bb3cc Avoid flicker while resizing 2014-11-19 03:31:47 +01:00
Přemysl Eric Janouch b352a0fc8d Rewrite to use termo
Also get rid of some silliness that I'm only able to see now.
2014-11-19 03:31:46 +01:00
Přemysl Eric Janouch a3348d888b I've been enlightened
Now responding to C-p, C-n, C-b, C-f and C-h as expected.
2014-02-11 23:28:02 +01:00
Přemysl Eric Janouch d7114f0634 Don't apply the bold attribute to padding.
It looked awful when it caused a change in the colour of underlining.
2013-10-09 02:54:19 +02:00
Přemysl Eric Janouch adce15243a Add a querying tool for use in e.g. IRC bots
Now the tools don't get built on `make all' but instead have their
own target called `tools'.  It might be reasonable to move them into
their own directory sometime, instead of cluttering `src'.
2013-10-02 02:17:38 +02:00
Přemysl Eric Janouch 1955343857 Add a workaround for GLib < 2.33.1
I wanted to have it working in Wheezy and this was standing in the way,
so I went for the quick fix that I'd made available to myself.
2013-10-02 02:11:57 +02:00
Přemysl Eric Janouch 190c21eabb Clarify some behaviour in comments 2013-10-02 02:11:10 +02:00
Přemysl Eric Janouch 8d586931e0 Thanks, Coverity 2013-07-25 07:42:43 +02:00
Přemysl Eric Janouch f8a8395114 Fix another error path 2013-07-18 19:47:07 +02:00
Přemysl Eric Janouch 1df7021276 Fix the dictionary loading error path 2013-07-18 00:16:57 +02:00
Přemysl Eric Janouch 852667350b Actually use DictzipInputStream in sdtui 2013-07-18 00:16:50 +02:00
Přemysl Eric Janouch 270539c72e Move private data into StardictDictPrivate 2013-07-18 00:16:50 +02:00
Přemysl Eric Janouch 15f62b7054 Add a class to handle dictzip files
Provides pseudo-random access to dictionary files compressed using dictzip.

It doesn't implement a cache, it just loads missing chunks until it has the
whole file.  I'm not sure if discarding not recently used chunks is really
a useful feature.  If there _was_ a way to get noticed when system memory
is low, I think the best way to handle that event would be to simply release
it all.

All in all, this is pretty useless.  But it was interesting to write.

This has yet to be integrated into the application proper.
2013-07-18 00:16:43 +02:00