diff --git a/ChangeLog b/ChangeLog index d515ef6a..737f1392 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-12-20 Markus Gans + * Fixed the drawing of FLabel widget with the default size + of 1×1 character. + Thanks to terranpro for reporting this issue + 2019-12-16 Markus Gans * New widget class FComboBox to provide a dropdown list with an input field diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index e955d3ed..b6090388 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -106,20 +106,6 @@ void FDropDownListBox::hide() flush(); } -//---------------------------------------------------------------------- -void FDropDownListBox::onKeyPress (FKeyEvent* ev) -{ - switch ( ev->key() ) - { - case fc::Fkey_escape: - case fc::Fkey_escape_mintty: - hide(); - break; - - default: - break; - } -} // private methods of FDropDownListBox //---------------------------------------------------------------------- @@ -368,6 +354,8 @@ void FComboBox::onKeyPress (FKeyEvent* ev) case fc::Fmkey_up: case fc::Fckey_up: + case fc::Fkey_escape: + case fc::Fkey_escape_mintty: hideDropDown(); ev->accept(); break; diff --git a/src/flabel.cpp b/src/flabel.cpp index 01bf3000..ce82e8a4 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -393,7 +393,7 @@ void FLabel::printLine (FString&& line) } else { - to_column = width - 2; + to_column = ( width >= 2 ) ? width - 2 : 0; to_char = getLengthFromColumnWidth(line, to_column); } @@ -436,7 +436,8 @@ void FLabel::printLine (FString&& line) if ( column_width > width ) { // Print ellipsis - print() << FColorPair(ellipsis_color, getBackgroundColor()) << ".."; + print() << FColorPair(ellipsis_color, getBackgroundColor()) + << FString("..").left(width); setColor(); } else if ( align_offset + to_column < width ) diff --git a/src/flineedit.cpp b/src/flineedit.cpp index c59e6b63..c4226d5e 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -689,7 +689,7 @@ bool FLineEdit::hasHotkey() //---------------------------------------------------------------------- void FLineEdit::draw() { - if ( cursor_pos == NOT_SET && isReadOnly() ) + if ( cursor_pos == NOT_SET && ! isReadOnly() ) cursorEnd(); if ( ! isShown() ) diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index d75d44b0..1871391e 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -100,9 +100,6 @@ class FDropDownListBox : public FWindow void show() override; void hide() override; - // Event handlers - void onKeyPress (FKeyEvent*) override; - private: // Methods void init(); diff --git a/src/include/final/fconfig.h b/src/include/final/fconfig.h index 4f481ea5..71879cdb 100644 --- a/src/include/final/fconfig.h +++ b/src/include/final/fconfig.h @@ -50,7 +50,9 @@ #endif /* Define to 1 if GPM mouse is enabled */ -/* #undef HAVE_LIBGPM */ +#ifndef F_HAVE_LIBGPM +#define F_HAVE_LIBGPM 1 +#endif /* Define to 1 if you have the header file. */ #ifndef F_HAVE_LINUX_FB_H diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index 18795098..639990a1 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -289,8 +289,8 @@ class FWidget : public FVTerm, public FObject void setMinimumHeight (std::size_t); void setMinimumSize (const FSize&); void setMaximumWidth (std::size_t); - void setMaximumHeight (const FSize&); - void setMaximumSize (std::size_t, std::size_t); + void setMaximumHeight (std::size_t); + void setMaximumSize (const FSize&); void setFixedSize (const FSize&); bool setCursorPos (const FPoint&); void unsetCursorPos(); @@ -882,13 +882,12 @@ inline void FWidget::setMaximumWidth (std::size_t max_width) { size_hints.setMaximum (FSize(max_width, size_hints.max_height)); } //---------------------------------------------------------------------- -inline void FWidget::setMaximumHeight (const FSize& size) -{ size_hints.setMaximum (size); } +inline void FWidget::setMaximumHeight (std::size_t max_height) +{ size_hints.setMaximum (FSize(size_hints.max_width, max_height)); } //---------------------------------------------------------------------- -inline void FWidget::setMaximumSize ( std::size_t max_width - , std::size_t max_height ) -{ size_hints.setMaximum (FSize(max_width, max_height)); } +inline void FWidget::setMaximumSize (const FSize& size) +{ size_hints.setMaximum (size); } //---------------------------------------------------------------------- inline void FWidget::setFixedSize (const FSize& size)