Results 1 to 7 of 7

Thread: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

  1. #1
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,165

    Default kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    A recent TW snapshot brought us kate V17.08.0-1.2.

    Since then if an existing plain text file with the extension ".txt" is opened, or a new one saved, kate erroneously applies syntax highlighting.

    http://paste.opensuse.org/view/raw/9ae0168b

    From the menu, "Tools -> Mode" and "Tools -> Highlighting" show that kate has "automagically" selected "Scripts PowerShell" as the file type.

    From "Settings -> Configure kate... -> Open/Save -> Modes & Filetypes" it can be seen that associated with "Scripts PowerShell":

    file extensions are *.ps1 *.ps1m and *.ps1d - which the plain text file clearly isn't (*.txt).

    mime types are text/plain - which the plain text file is.

    Removing the mime type results in plain text files correctly opening/saving without highlighting (Mode: Normal / Highlighting: None)
    Regards, Paul

    Tumbleweed (Snapshot: 20190814) KDE Plasma 5 ~~~
    Non-Tumbling Tumblweed (20150508) KDE 4 - Resurrected
    Leap 15.0 KDE Plasma 5 ~~~ Leap 15.1 KDE Plasma 5 (Work in progress...)

  2. #2

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    Confirmed on OpenSUSE Leap 42.2 with kate/kwrite 17.08.0, even with a newly created user.

    An newly created text-file is already opened with PowerShell highlighting (both kate/kwrite). This is a file created by Dolphin (right-click > Create New > Text File) and contains 2 characters: a space followed by a linefeed. Mime-type is text/plain, as reported by file --mime-type.

    An empty file (0 characters) is opened with Normal highlighting (both kate/kwrite).

    Cheers,
    Leen

  3. #3

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    Upstream bug in the syntax-highlighting framework, should be fixed in 5.38.0 (to be released next Saturday):
    https://bugs.kde.org/show_bug.cgi?id=383848

  4. #4
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,165

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    Thanks... again

    It seems the commit to fix this issue https://phabricator.kde.org/R216:26d...66d64cb30b0c26 simply removes the mime type association from (kate's) "Modes & Filetypes", which, as I wrote in the first post, is what I did to "cure" the problem when I first discovered it.
    Regards, Paul

    Tumbleweed (Snapshot: 20190814) KDE Plasma 5 ~~~
    Non-Tumbling Tumblweed (20150508) KDE 4 - Resurrected
    Leap 15.0 KDE Plasma 5 ~~~ Leap 15.1 KDE Plasma 5 (Work in progress...)

  5. #5

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    Quote Originally Posted by tannington View Post
    It seems the commit to fix this issue https://phabricator.kde.org/R216:26d...66d64cb30b0c26 simply removes the mime type association from (kate's) "Modes & Filetypes", which, as I wrote in the first post, is what I did to "cure" the problem when I first discovered it.
    Indeed.
    The upstream fix removes the text/plain mimetype from the "Powershell" definition file.
    I.e. what you did manually.

    You may want to remove your custom config when the update is available, unless you have other modifications...
    (I think it should be in .local/share/syntax-highlighting...)
    Last edited by wolfi323; 04-Sep-2017 at 07:29.

  6. #6

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    Quote Originally Posted by wolfi323 View Post
    (I think it should be in .local/share/syntax-highlighting...)
    Actually it rather seems to be .config/katemoderc ...
    Sorry.

  7. #7
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,165

    Default Re: kate (erroneously) applies syntax highlighting to plain text files (*.txt)

    OK... Thanks, added a note to my ever growing to-do list
    Regards, Paul

    Tumbleweed (Snapshot: 20190814) KDE Plasma 5 ~~~
    Non-Tumbling Tumblweed (20150508) KDE 4 - Resurrected
    Leap 15.0 KDE Plasma 5 ~~~ Leap 15.1 KDE Plasma 5 (Work in progress...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •