Page 1 of 1

Cannot turn off auto displaying of images (drag'n'drop)

Posted: 03.04.2026 17:58
by alexdata
Ver: 1.233.2.0 qt6 (and i've tested with versions as far back as 1.227.0.0 with the same result)
OS: Linux Arch.
Plugins: "cuda-ext" and "encode" are installed.

Can anyone please help me on how to force images to display as binary (or hex/text) instead of images - when drag and drop onto the cudatext window?

Issue: When I drag and drop images like png, jpg, webp onto cudatext GUI window, it opens and displays them as images - instead of as hex, binary or text (what i need). If I start the program by CLI, then I can cause it to open an image in hex or binary view, but never with drag and drop files onto the GUI, they open as images.

CLI forced opening works, but is to slow and tedious compared to notepad++ or kate.
./cudatext.sh --cfg-user -z=hex "img.webp" (works, but is a slow way of working with files)
./cudatext.sh --cfg-user -z=text "img.webp" (works, but is a slow way of working with files)
drag and drop images onto cudatext GUI window only shows them as images. Not as text/hex/binary, and not in the viewer(hex/bin) at all.

Doing the CLI method for each file I want opened in the viewer (the viewer can view things as either; text, hex, binary, unicode) is slow/difficult.
So I tried disable/change this behavior using the users settings. Some settings do change cudatext behavior, while other settings are just ignored.

Uninstalling/moving/renaming the "cuda-ext" and "encode" plugins causes no changes in behavior, so the plugins are not the cause of this behavior.

Any settings (in user.json) to try to disable the "auto show images, as images" - instead of showing them as text/hex/binary does NOT work:
"ui_non_text": 4,
"ui_not_text_ext": "png;jpg;jpeg;gif;bmp;ico;webp",
"ui_open_ext": "png:hex;jpg:hex;jpeg:hex;gif:hex;bmp:hex;ico:hex;webp:hex",
"ui_non_text_buffer": 64,
"viewer_img_ext": ""

"ui_non_text": 4,
"ui_not_text_ext": "png;jpg;jpeg;gif;bmp;ico;webp",
"viewer_img_ext": "",
"ui_open_ext": "png:hex;jpg:hex;jpeg:hex;gif:hex;bmp:hex;ico:hex;webp:hex"

"ui_non_text": 4,
"ui_non_text_all": true,
"ui_not_text_ext": "png;jpg;jpeg;gif;bmp;ico;webp",
"viewer_img_ext": "",
"ui_open_ext": "png:hex;jpg:hex;jpeg:hex;gif:hex;bmp:hex;ico:hex;webp:hex"

"ui_non_text": 4,
"ui_open_ext": "png:viewer;jpg:viewer;jpeg:viewer;webp:viewer;gif:viewer;bmp:viewer",
"viewer_img_ext": ""

"ui_non_text_all": true,
"ui_non_text_buffer": 0,
"ui_non_text": 4,
"viewer_img_ext": ""

"ui_non_text": 4,
"ui_not_text_ext": "png;jpg;jpeg;gif;bmp;ico;webp",
"viewer_img_ext": "",
"ui_open_ext": "png:hex;jpg:hex;jpeg:hex;gif:hex;bmp:hex;ico:hex;webp:hex"

While settings like these DO WORK, and changes cudatext to look and behave as these settings suggest:
{
"ui_theme": "cobalt",
"ui_theme_syntax": "cobalt",
"mouse_middle_click": 2,
"ui_title_path": true,
"auto_copy_clp": "p",
"unprinted_show": false,
"unprinted_content": "sd.",
"font_name__linux": "Noto Sans Mono",
"font_size__linux": 11,
"ui_toolbar_show": true
}


So please, someone let me know how to actually do this.

Re: [can repeat] Cannot turn of auto displaying of images (drag'n'drop)

Posted: 03.04.2026 19:18
by main Alexey
I made a primitive plugin for this task: open all picture-files (even from drag-drop) in hex mode.

wiki: https://wiki.freepascal.org/CudaText
topic: 'How to open all picture-files in hex mode'.

please test.

Re: Cannot turn off auto displaying of images (drag'n'drop)

Posted: 04.04.2026 01:08
by alexdata
Your suggestion worked, Alexey! Thanks!
Also thanks for a great editor!

Can I ask what I need to modify in the .py code to have it display as binary? it does now display as hex by default. I know I can use the status bar "Viewer:hex" and change that to "Viewer:Binary", but can I also change the default way of opening it to binary, by editing the .py code?

I had to do quite some reading to figure out how to make it work, since the part of the page you linked to, did not explain how make the two files into an "installer zip" and then "how to install that zip". But hey, I figured it out, by reading the rest of the page.

All Steps:
The two files have to be packed in a .zip file (not tar or tar.gz) (I used ARK for this on Linux).
The two files must be added to the .zip file as two separate files (do not drag'n'drop a folder into the zip file)
I named the zip file: cuda_open_images_as_hex.zip (standard zip compression, no pasword, no folder, just files)
Then this newly created .zip file must be opened in cudatext as if it was a text file:
File > Open File > (find correct path with zip file) > select the zip file > press "Open" button.
A plugin install dialog appears, follow the dialogs, press OK whan asked if you want to install it, and press OK on the next dialog. Then restart cudatext.
Now drag'n'drop any imagefile of the type: "bmp,png,gif,jpg,jpeg,ico,tga,cur,psd,webp" and it will open in a hexview.

Here are the two files mentioned in the link that Alexey shared (copy the filecontent from Alexey's link, or the below text):

File py/cuda_open_images_as_hex/install.inf >>

Code: Select all

[info]
title=Open images in hex mode
desc=(Fill the description)
type=cudatext-plugin
subdir=cuda_open_images_as_hex
homepage=(Fill the GitHub repo URL)
 
[item1]
section=events
events=on_open_pre

File py/cuda_open_images_as_hex/__init__.py >>

Code: Select all

import os
from cudatext import *

IMG_TYPES = 'bmp,png,gif,jpg,jpeg,ico,tga,cur,psd,webp'.split(',')

class Command:

    def on_open_pre(self, ed_self, filename):
        fn = os.path.basename(filename).lower()
        for ext in IMG_TYPES:
            if fn.endswith('.'+ext):
                file_open(filename, options='/view-hex')
                print('Forced hex for file: '+filename)
                return False

Re: Cannot turn off auto displaying of images (drag'n'drop)

Posted: 04.04.2026 07:18
by main Alexey
>>what I need to modify in the .py code to have it display as binary?

Very simple. Change string const:
'/view-hex'
to one of these, quote from cudatext_api.wiki:

** If it has '/view-text', then file will open in internal viewer, text (variable width) mode.
** If it has '/view-binary', then file will open in internal viewer, binary (fixed width) mode.
** If it has '/view-hex', then file will open in internal viewer, hex mode.
** If it has '/view-unicode', then file will open in internal viewer, unicode (variable width) mode.

Re: Cannot turn off auto displaying of images (drag'n'drop)

Posted: 04.04.2026 09:11
by alexdata
Thanks for your excellent answers, Sir!
I will surely recommend this editor to my friends! It reminds me of notepad++ and I mean that as a compliment! However, the fact that plugins can be made with python code, likely makes it better than notepad++ (yes, I am an ex-windows user). I think I'll be able to eventually make some plugin of my own! I found CudaText yesterday, and already today it is set up to fit my needs perfectly. Thanks to Alexey and his quick responses, and thanks to everyone contributing skills when making CudaText! Thanks!

Re: Cannot turn off auto displaying of images (drag'n'drop)

Posted: 04.04.2026 09:20
by main Alexey
Thanks! :) As a new user, you may find some 'weak places' in UI, feel free to report them. In new topics, pls.

Re: Cannot turn off auto displaying of images (drag'n'drop)

Posted: 04.04.2026 14:08
by alexdata
Sure thing! I will let you know if I find any weak places, weak spots, in the GUI ! ;)