aboutsummaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/Panel.c b/Panel.c
index 5d10375..dea6401 100644
--- a/Panel.c
+++ b/Panel.c
@@ -69,7 +69,7 @@ void Panel_done(Panel* this) {
free(this->eventHandlerState);
Vector_delete(this->items);
FunctionBar_delete(this->defaultBar);
- RichString_end(this->header);
+ RichString_delete(&this->header);
}
void Panel_setSelectionColor(Panel* this, ColorElements colorId) {
@@ -172,13 +172,13 @@ void Panel_moveSelectedDown(Panel* this) {
}
}
-int Panel_getSelectedIndex(Panel* this) {
+int Panel_getSelectedIndex(const Panel* this) {
assert (this != NULL);
return this->selected;
}
-int Panel_size(Panel* this) {
+int Panel_size(const Panel* this) {
assert (this != NULL);
return Vector_size(this->items);
@@ -246,8 +246,8 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
if (this->scrollV < 0) {
this->scrollV = 0;
this->needsRedraw = true;
- } else if (this->scrollV >= size) {
- this->scrollV = MAXIMUM(size - 1, 0);
+ } else if (this->scrollV > size - h) {
+ this->scrollV = MAXIMUM(size - h, 0);
this->needsRedraw = true;
}
// ensure selection is on screen
@@ -269,7 +269,7 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
if (this->needsRedraw || force_redraw) {
int line = 0;
for (int i = first; line < h && i < upTo; i++) {
- Object* itemObj = Vector_get(this->items, i);
+ const Object* itemObj = Vector_get(this->items, i);
RichString_begin(item);
Object_display(itemObj, &item);
int itemLen = RichString_sizeVal(item);
@@ -287,7 +287,7 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
RichString_printoffnVal(item, y + line, x, scrollH, amt);
if (item.highlightAttr)
attrset(CRT_colors[RESET_COLOR]);
- RichString_end(item);
+ RichString_delete(&item);
line++;
}
while (line < h) {
@@ -296,11 +296,11 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
}
} else {
- Object* oldObj = Vector_get(this->items, this->oldSelected);
+ const Object* oldObj = Vector_get(this->items, this->oldSelected);
RichString_begin(old);
Object_display(oldObj, &old);
int oldLen = RichString_sizeVal(old);
- Object* newObj = Vector_get(this->items, this->selected);
+ const Object* newObj = Vector_get(this->items, this->selected);
RichString_begin(new);
Object_display(newObj, &new);
int newLen = RichString_sizeVal(new);
@@ -316,8 +316,8 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
RichString_printoffnVal(new, y + this->selected - first, x,
scrollH, MINIMUM(newLen - scrollH, this->w));
attrset(CRT_colors[RESET_COLOR]);
- RichString_end(new);
- RichString_end(old);
+ RichString_delete(&new);
+ RichString_delete(&old);
}
if (focus && (this->needsRedraw || force_redraw || !this->wasFocus)) {
@@ -454,7 +454,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
if (len < 99) {
buffer[len] = ch;
- buffer[len+1] = '\0';
+ buffer[len + 1] = '\0';
}
for (int try = 0; try < 2; try++) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy