Skip to content

Commit 3d5a866

Browse files
committed
FLTK: fix file save as handling
1 parent 2044a35 commit 3d5a866

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2019-06-27 (0.12.15)
2+
FLTK: file file save as
3+
UI: fix reported crash in android printing null
4+
15
2019-06-22 (0.12.15)
26
FLTK: reactivated the FLTK port using FLTK v1.4
37

src/platform/fltk/EditorWidget.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,8 @@ void EditorWidget::copyText() {
651651
/**
652652
* saves the editor buffer to the given file name
653653
*/
654-
void EditorWidget::doSaveFile(const char *newfile) {
655-
if (!_dirty && strcmp(newfile, _filename) == 0) {
654+
void EditorWidget::doSaveFile(const char *newfile, bool force) {
655+
if (!force && !_dirty && strcmp(newfile, _filename) == 0) {
656656
// neither buffer or filename have changed
657657
return;
658658
}

src/platform/fltk/EditorWidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct EditorWidget : public Fl_Group, StatusBar {
9797

9898
bool checkSave(bool discard);
9999
void copyText();
100-
void doSaveFile(const char *newfile);
100+
void doSaveFile(const char *newfile, bool force=false);
101101
void fileChanged(bool loadfile);
102102
bool focusWidget();
103103
const char *getFilename() { return _filename; }

src/platform/fltk/FileWidget.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ void FileWidget::saveAs() {
515515
}
516516
const char *msg = "%s\n\nFile already exists.\nDo you want to replace it?";
517517
if (access(savepath, 0) != 0 || fl_choice(msg, "Yes", "No", 0, savepath) == 0) {
518-
_saveEditorAs->doSaveFile(savepath);
518+
_saveEditorAs->doSaveFile(savepath, true);
519519
}
520520
}
521521
}

src/ui/ansiwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ int AnsiWidget::getScreenId(bool back) {
185185

186186
// prints the contents of the given string onto the backbuffer
187187
void AnsiWidget::print(const char *str) {
188-
int len = strlen(str);
188+
int len = (str == NULL ? 0 : strlen(str));
189189
if (len) {
190190
_back->drawInto();
191191

0 commit comments

Comments
 (0)