tsujan / FeatherPad

Lightweight Qt Plain-Text Editor for Linux
GNU General Public License v3.0
392 stars 66 forks source link

Some missed things #78

Closed agaida closed 6 years ago

agaida commented 6 years ago

fpad atom

Some differences to atom - or functionality that i missed a lot: I. Cursor Position in status line (and maybe the cursor more visible) II. free configurable line (i want to see, when i'm over 79 chars for python or 80 for debian things) III. I want to choose the lexer myself - i'm fine with the autodetection most of the time, but i need a override for it (atom let me choose it) iV. optinal full path to file V. not marked - but the line endings are fugly and to prominent

tsujan commented 6 years ago

I. Cursor Position in status line

Implemented a few hours ago.

II. free configurable line... III. I want to choose the lexer myself

You should be more specific here. What's "lexer"? What do you mean by a "configurable line"?

optinal full path to file

It's there: right click on the tab!

not marked - but the line endings are fugly and to prominent

That's a Qt bug, for which I haven't found a workaround yet. I guess other Qt text editors use ready libraries for that and don't have to write the code.

tsujan commented 6 years ago

BTW, the full path is also on the tab tool-tip.

tsujan commented 6 years ago

Oh, by lexer you mean the language? If so, I remember we had this discussion before.

Changing the programming language doesn't make sense, IMO, and I don't know why some editors have an option for it. You save your bash script/markdown text/... as a bash script/markdown text/... and its syntax will be highlighted correctly. An unsaved text isn't a file. And why not saving it from start?

Moreover, changing the highlighter of a python script to that of C++, for example, not only doesn't make sense but also should be prevented.

Programming languages aren't like encodings -- the former is exact but the latter is based on guesses; hence the need for selecting encodings but not for programming languages.

I still don't understand what you mean by "free configurable line".

agaida commented 6 years ago

it makes much sense if the language is not detected correct :)

git diff libfswatch_config.h.in libfswatch_config.h.in~ 
^^ no difference

fpad1 fpad2 second - where is the tab i can click on? :P fpad3 configurable line - i want a visible vertical line at the preferred line length - forget about the atom description - essential if i want to write python and don't want the pep8 checker jumping into my face everytime - or writing bash and dont want the line lenght check to jump in at 80 chars (same for some debian files)

tsujan commented 6 years ago

In your example, libfswatch_config.h.in~ is a backup file, not a C/C++ source/header file, and cannot be used in any source. FeatherPad correctly sees that. Why should we highlight the syntax of a backup file? Where can it be used? It could be used only if the ending ~ was removed and, in that case, FeatherPad would know that and would highlight its syntax accordingly.

As a matter of fact, that's exactly how all file managers deal with files. They show libfswatch_config.h.in as text/x-csrc but libfswatch_config.h.in~ as application/x-trash. This behavior is very correct.

As for the configurable lines, I should really install atom and see first hand.

tsujan commented 6 years ago

BTW, for the cursor position, see https://github.com/tsujan/FeatherPad/issues/77#issuecomment-362906226

tsujan commented 6 years ago

OK, I installed atom from AUR:

Total Download Size:    61.99 MiB
Total Installed Size:  293.76 MiB 

It consumes 340 MiB of RAM when started, its GUI is very counter-intuitive, its statusbar is poor, its scrollbar is a joke, its syntax highlighting can't distinguish Qt key words (like qMin or QProcess), QML or even GTK key words, it doesn't support tab DND, it isn't aware of virtual desktops...

As for those vertical lines, I saw them and will think about them. Yes, they can be useful but I should find a way for them not to interfere with indentation lines (atom mixes them up).

Now I should uninstall atom as soon as possible ;)

agaida commented 6 years ago

Re: formats - Ok - from a developer point of view you might be right, but from a user point of view you are not - in other words: The editor don't do what i want, so it is useless for me in that usecase. So, if i had to use another editor like atom, mousepad, juffed for that work - why install featherpad at all?

tsujan commented 6 years ago

Please tell me why you want the "syntax" (if any) of a backup file to be highlighted? Isn't that use case too personal?

agaida commented 6 years ago

no - the backup file was just an example - i want to be able to override detected formats for any kind of file. I use that on a regular base like for files with mixed contents. Best example are pbuilder or sbuilder logs, as they might contain embedded diffs - and in that case i want to be able to switch from simple text to diff, because it ease my work - one can think about these things like viewing a website with some mixed content: maybe a diff, maybe sample c-code, some python and so on.

tsujan commented 6 years ago

Files with mixed contents should be valid "source" files for their syntax to be highlighted. For example, HTML can contain JavaScript and, of course, it contains lots of CSS code. I had a hard time to make all this right. It's important to highlight JS inside HTML correctly.

However, suppose that a .log file (text/x-log) contains a CSS code. Apart from habits, what's the practical use of highlighting CSS inside a log file?

I think we can't convince each other in this case. I'm sorry that just because of this, you want to uninstall FeatherPad -- your reports have been very useful.

tsujan commented 6 years ago

BTW, I just saw that atom's JS inside HTML is wrong -- actually its pure JS syntax highlighting is wrong too. IMO, these are what is practical.

agaida commented 6 years ago

i don't uninstall featherpad - i'm kind of forced to use it as I'm the maintainer for it in debian :D - joke aside, the follow up is a real life use case - i just uploaded fswatch because some symbols have changed with gcc 7.3 - someone noticed that and wrote a bug:

So my workflow is like that: https://www.youtube.com/watch?v=CGy2TLBGayA

and as you can see in the status page i have to do this approx 20 times - one of the things that sucks a lot, but must be done - and it helps a lot if one have tools that support this work, in my case atom, bcompare, some self written mangling scripts and some small and fast editor

tsujan commented 6 years ago

Honestly, I'm not convinced --- but you know what? Since you didn't uninstall FeatherPad, I'll add "syntax selection" as an option and disabled by default ;) A win-win scenario!

I should just find a way that doesn't damage the GUI.

tsujan commented 6 years ago

A small button on the statusbar, perhaps.

agaida commented 6 years ago

:) - just display the Source: none - if no source is detected and if enabled show a rollup if one click on it with the available types

tsujan commented 6 years ago

It should be very easy to implement. The only thing that will need a thought is the GUI; otherwise, the highlighting code is already there.

Sometimes, it's better that I shut my mouth and just code ;)

tsujan commented 6 years ago

I'll go with something like this:

langs

tsujan commented 6 years ago

The syntax override is implemented (in https://github.com/tsujan/FeatherPad/commit/57e3ec1bf9a3ef14c523843361b2be554686bc87) as an option and can be enabled in Preferences → Text → Support syntax override, provided that Highlight syntax by default is also checked. The changes will take effect after closing the Preferences dialog.

The GUI code is a little tricky because several combinations should have been taken into account. I hope I've made no mistake and there's no bug. However, this needs many tests by enabling/disbling various options, both in Preferences and in the main window, and also swirching tabs/side-pane items.

It's fun to see a C++ file formatted as Python ;) BTW, a reload corrects the formatting language.

tsujan commented 6 years ago

Ah, after several tests, at last, found a workaround to gray out those paragraph/text endings:

line_end

The only thing that remains is configurable vertical rulers -- a work for later.

tsujan commented 6 years ago

Added configurable vertical position lines. See Preferences → Text → under syntax highlighting. A screenshot:

vline

Nothing is missing anymore (the full path was already there in 2 ways -- actually, in 3 ways). Closing this -- please open separate issues for probable bugs but there shouldn't be any ;)

tsujan commented 6 years ago

Fixed a silly problem in the language button when the language was changed from normal. Please update if you use that feature, although I'll add other features before releasing V0.8.

EDIT: Also fixed a regression in deb control formatting after a recent commit.