Skip to content

Fix insertPopup and echoPopup to accept "main" as an argument#3013

Merged
vadi2 merged 1 commit intoMudlet:developmentfrom
vadi2:fix-main-argument
Aug 21, 2019
Merged

Fix insertPopup and echoPopup to accept "main" as an argument#3013
vadi2 merged 1 commit intoMudlet:developmentfrom
vadi2:fix-main-argument

Conversation

@vadi2
Copy link
Copy Markdown
Member

@vadi2 vadi2 commented Aug 21, 2019

Brief overview of PR changes/additions

Fix insertPopup and echoPopup to accept "main" as an argument.

Motivation for adding to Mudlet

More consistency in the API.

Other info (issues closed, discussion etc)

Needed by #3009.

insertPopup()'s code isn't up to our standards - but I'd just like to fix this one issue right now.

@vadi2 vadi2 added this to the 4.1.0 milestone Aug 21, 2019
@vadi2 vadi2 requested a review from a team as a code owner August 21, 2019 08:56
@vadi2 vadi2 requested review from a team August 21, 2019 08:56
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Aug 21, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@demonnic
Copy link
Copy Markdown
Member

Tested as working, thanks

@vadi2 vadi2 merged commit 2feca54 into Mudlet:development Aug 21, 2019
@vadi2 vadi2 deleted the fix-main-argument branch August 21, 2019 13:02
vadi2 pushed a commit to vadi2/Mudlet that referenced this pull request Aug 21, 2019
* Refactor: extract a simple function that is used in several five places

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Refactor: eliminate shadowed variables in TTextEdit::mouseMoveEvent(...)

The use of `x` and `y` in nested code is confusing as the inner ones mask
the outer ones. This commit renames the inner copies.

It also makes a local reference to a section of the text attribute buffer:
`(std::deque<std::deque<TChar>>) TBuffere::buffer) that is used several
times.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* BugFix: cure the faulty selection when crossing an empty line.

The use of *manhattenLength()* was incorrect when determining whether it
was the start or end of the selection that was nearest to the mouse cursor,
instead it now (correctly) only considers the horizontal (x) offset when
the vertical offsets of the start and end point of the selection are equal.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* BugFix: finally cures the selection of text both with and without timestamps

Also:
* abstract the number of spaces for the timestamp on the left to a constant
`(int) TTextEdit::mTimeStampWidth`.

* renames `y` and `x` variables in the `TTextEdit::mouseMoveEvent(...)` to
`lineIndex` and `tCharIndex` as that more accurately describes them - and
also rename another pair of shadowing/masking `y` and `x` variables in the
SAME method to `yIndex` and `xIndex` respectively.

* convert a few remaining random C-style `(int)` casts in `TTextEdit` class
to C++ `static_cast<int>(...)` ones.

NOTE: An issue with deselection something in an upward direction against
the left margin remains - however the area is being correctly deselected
but code elsewhere that analyses which parts of the display actually
require repainting is missing that portion of the modified area of text.
It appears to be within the `TTextEdit::highlight()` method but it IS a
separate issue as the underlying text attribute buffer is being
correctly changed to clear the selection flags.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Revise: make time stamps show in lower pane as well as upper one

It is visually disturbing for the lower pane in the main, error and debug
consoles not to match the upper one when it is revealed by scrolling - or
by turning on the timestamps for the main console.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Revise: reduce space for time stamps from 15 to 13 (12 + space) characters

The use of 15 rather than 13 produced the need for an additional tweak when
trying to work out where the first actual game text start when trying to
deduce the position of it relative to the cursor!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Fix insertPopup and echoPopup to accept "main" as an argument (Mudlet#3013)

* Update: drop support for saving to Mudlet 2.1 map format & update default

This PR removes support for saving in the binary map file format of Mudlet
2.1 - i.e. format **16** (retaining the ability to read it) and adjusts the
format for new map files to be **20** by default - up from the previous
default of **18**. This should speed up map loading a little - as it will
remove the need to convert the data to the current forms used internally as
well as making some details more robust. It also allows the removal of some
warning code that would have fired if area or map user data features were
used and format *16* was selected for saving.

#### History of recent (last six years) changes to Map File Format:

* dfce0f0 (PR Mudlet#2106) - **20** Improved way
that custom exit line data was held internally (so that the keys are now
the same as the other exit details that are keyed by a string {doors, exit
weight}. The custom exit line style is stored as the shorter and easier to
code with `Qt::PenStyle enum`  instead of a English `QString` and the
custom exit line as a `QColor` instead of a `QList<int>` with 3 elements -
(so the custom exit line could have a alpha component in the future!) Code
is in place to support a workaround to work within map formats back to
include version 17.

* 91a08c3 (PR Mudlet#1543) - **19** Added support
for more than one of any grapheme for the 2D map room symbol. Code is
in place to support a workaround to work within map formats back to include
version 17.

* 94dd41b (associated with PR Mudlet#301) - **18**
Added support for multiple user rooms in map file copied to other profiles
- so that the original player room (in the other profile) is retained in a
map copied over. Also revised the `TArea::rooms` from being a `QList` to a
faster to look up in `QSet`. Code in place to support saving in previous
formats.

* fb79c62 (associated with PR Mudlet#280) - **17**
Added support for area and map user data features. Warnings are issued
should these be actually used and a lower map format is specified to save
the map in **as that data will then be lost from the map file**.

* 88ef649 - **16** Map format of Mudlet 2.1
dating back to 2013-01-02 .

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* BugFix: handle empty SGR...m sequences so they are treated as SGR0m

The empty (no parameter) case is the same as the one with a single 0 which
is the reset attributes case. Mudlet was not handling it as that but it
will do after this commit.

This will close issue Mudlet#2993 .

Also clean up some tabs used for spaces in the same method:
`(void) TBuffer::translateToPlainText(...)`

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Revise: some commented material in TTextExit::convertMouseXToBufferX

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
dicene pushed a commit to dicene/Mudlet that referenced this pull request Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants