Rewrapping text in a miniconsole

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: Rewrapping text in a miniconsole

Post by Jor'Mox »

I just created and ran an example script as follows:
Code: [show] | [select all] lua
local name = "testbuffer"
createBuffer(name)
echo(name,"1\n" .. "2\n" .. "3\n" .. "4\n" .. "5\n" .. "testing\n")
moveCursor(name,0,0)
display(getCurrentLine(name))  -- "1"
moveCursor(name,0,4)
display(getCurrentLine(name))  -- "5"
display(getLineCount(name))  -- 0
display(getLastLineNumber(name))  -- -1
moveCursor(name,3,5)
display(getCurrentLine(name))  -- "testing"
display(getColumnNumber(name)) -- 1
Am I doing something wrong that I don't see? Or do you get similar results?

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Rewrapping text in a miniconsole

Post by Vadi »

@replace: I've added an option to it that allows for preservation of the foreground & background colors, and forgot to include the optional window name argument in it. This has now been rectified in the latest code (and the example prints "here is a a lot of text" to the buffer").

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: Rewrapping text in a miniconsole

Post by Jor'Mox »

The first set of issues was that I was testing with a MiniConsole, and even though the text was changed for it, it wasn't redrawn, so I didn't see the change. Clicking or scrolling made the changed text appear. Similar to the font change issue behavior.
The second issue, shown in the example on this page, is that a number of the functions used to navigate in a buffer or MiniConsole are not working for anything but the main window.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Rewrapping text in a miniconsole

Post by Heiko »

1. What's your OS?
2. Current git version is very different from 2.1 and the drawing issues you report can't be replicated anymore. Please use this for your tests. If you're on windows and can't compile Mudlet yourself, I'd need to make an snapshot windows release.
3. Can you please make a list of the affected funcs and a second list with funcs that you think are missing. Right now is the best time for this because there'll be a new major release soon.

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: Rewrapping text in a miniconsole

Post by Jor'Mox »

1. I am using Mac OS X 10.8.3

2. While I would be willing to test to see if issues have been resolved on the most up to date version, I have no idea how to go about compiling a copy for myself, though, from what I understand, it is at least possible.

3. I assume you would prefer that I compile such a list after I acquire an up to date version of Mudlet to test on, so that I am not reporting issues that have already been fixed? If that is the case, then if someone can either point me to where I can get such a version, or to reasonably detailed instructions on how to compile one myself, that would be great. If not, I can put a list together for you this morning of the functions that are not working in Mudlet 2.1 and the results that they give in various situations.

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: Rewrapping text in a miniconsole

Post by Jor'Mox »

In 2.1, here is what I'm seeing:
getColumnNumber: returns the column for the for the main window, regardless of argument
getLineNumber: returns the line number for the main window, regardless of argument
getLineCount: returns the line count for the main window with no argument, with any argument (including "main"), returns 0
getLastLineNumber: has an error with no argument, returns the last line number for the main window with "main", returns -1 for any other argument
getLines: has an error if given a window name argument
prefix: accepts a window argument, properly passed to moveCursor function, but not passed to getLineNumber function
suffix: same as prefix
Here is the prefix function from GUIUtils.lua, note the first line, which would get the line number from the main window to use in the window it is passed as an argument.
Code: [show] | [select all] lua
function prefix(what, func, fg, bg, window)
	moveCursor(window or "main", 0, getLineNumber());
	if func and (func == cecho or func == decho or func == hecho) then
		func(what, fg, bg, true, window)
	else
		insertText(what)
	end
end

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Rewrapping text in a miniconsole

Post by Vadi »

At least one of them, https://bugs.launchpad.net/mudlet/+bug/1101400 is reported. Could use to add the rest onto that bug. I'll fix the prefix and suffix functions.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Rewrapping text in a miniconsole

Post by Heiko »

The reported client functions have been fixed, but I haven't updated git yet. Maybe we should set up an automatic git build system for windows & mac binaries because nobody tests the dev builds anymore. This is *VERY* bad for quality control.

@JorMox
As you're on OSX 10.8, how about the import file dialogs? Still hidden?

Jor'Mox
Posts: 1154
Joined: Wed Apr 03, 2013 2:19 am

Re: Rewrapping text in a miniconsole

Post by Jor'Mox »

If you are talking about the dialog that pops up when I push the import button, then, no, it shows up just fine. But if this error showed up in a dev build, then I have no idea. I still only have the latest release, as stated above.

I would be perfectly willing to test things on a dev build (though obviously I would prefer to use a public build for most things since I develop script packages for others to use), but not having something I can just download and use is something of a hindrance. I'm sure more people would be willing to test if they didn't have to compile the executables themselves.

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Rewrapping text in a miniconsole

Post by Vadi »

Jor'Mox wrote:In 2.1, here is what I'm seeing:
getColumnNumber: returns the column for the for the main window, regardless of argument
getLineNumber: returns the line number for the main window, regardless of argument
getLineCount: returns the line count for the main window with no argument, with any argument (including "main"), returns 0
getLastLineNumber: has an error with no argument, returns the last line number for the main window with "main", returns -1 for any other argument
getLines: has an error if given a window name argument
prefix: accepts a window argument, properly passed to moveCursor function, but not passed to getLineNumber function
suffix: same as prefix
Here is the prefix function from GUIUtils.lua, note the first line, which would get the line number from the main window to use in the window it is passed as an argument.
Code: [show] | [select all] lua
function prefix(what, func, fg, bg, window)
	moveCursor(window or "main", 0, getLineNumber());
	if func and (func == cecho or func == decho or func == hecho) then
		func(what, fg, bg, true, window)
	else
		insertText(what)
	end
end
A few of them are defined this way in documentation. getColumnNumber(), getLineNumber(), getLines(), don't mention accepting window arguments, so you can't really fault them for not working with them. Something to fix, but it shouldn't be misleading (not according to the docs anyway, it is when going with the general design). getLastLineNumber() was missing its definition (!) so I've added it. However, it is returning the line number properly for a MiniConsole:
Code: [show] | [select all] lua
HelloWorld = Geyser.MiniConsole:new({
  name="HelloWorld",
  x="70%", y="50%",
  width="30%", height="50%",
})

print(getLastLineNumber("HelloWorld"))

HelloWorld:echo("hello!\n")
HelloWorld:echo("hello!\n")
HelloWorld:echo("hello!\n")

print(getLastLineNumber("HelloWorld"))

Post Reply