-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix export to plain text of multiple nodes with tables and/or codebox…
…es (#1880)
- Loading branch information
Showing
5 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* ct_export2txt.cc | ||
* | ||
* Copyright 2009-2020 | ||
* Copyright 2009-2021 | ||
* Giuseppe Penone <[email protected]> | ||
* Evgenii Gurianov <https://github.com/txe> | ||
* | ||
|
@@ -39,7 +39,7 @@ Glib::ustring CtExport2Txt::node_export_to_txt(CtTreeIter tree_iter, fs::path fi | |
} | ||
plain_text += CtConst::CHAR_SPACE + tree_iter.get_node_name() + CtConst::CHAR_NEWLINE; | ||
} | ||
plain_text += selection_export_to_txt(tree_iter.get_node_text_buffer(), sel_start, sel_end, false); | ||
plain_text += selection_export_to_txt(tree_iter, tree_iter.get_node_text_buffer(), sel_start, sel_end, false); | ||
plain_text += str::repeat(CtConst::CHAR_NEWLINE, 2); | ||
if (filepath != "") | ||
g_file_set_contents(filepath.c_str(), plain_text.c_str(), (gssize)plain_text.bytes(), nullptr); | ||
|
@@ -76,10 +76,10 @@ void CtExport2Txt::nodes_all_export_to_txt(bool all_tree, fs::path export_dir, f | |
} | ||
|
||
// Export the Buffer To Txt | ||
Glib::ustring CtExport2Txt::selection_export_to_txt(Glib::RefPtr<Gtk::TextBuffer> text_buffer, int sel_start, int sel_end, bool check_link_target) | ||
Glib::ustring CtExport2Txt::selection_export_to_txt(CtTreeIter tree_iter, Glib::RefPtr<Gtk::TextBuffer> text_buffer, int sel_start, int sel_end, bool check_link_target) | ||
{ | ||
Glib::ustring plain_text; | ||
std::list<CtAnchoredWidget*> widgets = _pCtMainWin->curr_tree_iter().get_anchored_widgets(sel_start, sel_end); | ||
std::list<CtAnchoredWidget*> widgets = tree_iter.get_anchored_widgets(sel_start, sel_end); | ||
|
||
int start_offset = sel_start >= 0 ? sel_start : 0; | ||
for (CtAnchoredWidget* widget: widgets) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
/* | ||
* ct_export2txt.h | ||
* | ||
* Copyright 2017-2020 Giuseppe Penone <[email protected]> | ||
* Copyright 2009-2021 | ||
* Giuseppe Penone <[email protected]> | ||
* Evgenii Gurianov <https://github.com/txe> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -34,7 +36,7 @@ class CtExport2Txt | |
public: | ||
Glib::ustring node_export_to_txt(CtTreeIter tree_iter, fs::path filepath, CtExportOptions export_options, int sel_start, int sel_end); | ||
void nodes_all_export_to_txt(bool all_tree, fs::path export_dir, fs::path single_txt_filepath, CtExportOptions export_options); | ||
Glib::ustring selection_export_to_txt(Glib::RefPtr<Gtk::TextBuffer> text_buffer, int sel_start, int sel_end, bool check_link_target); | ||
Glib::ustring selection_export_to_txt(CtTreeIter tree_iter, Glib::RefPtr<Gtk::TextBuffer> text_buffer, int sel_start, int sel_end, bool check_link_target); | ||
|
||
Glib::ustring get_table_plain(CtTable* table_orig); | ||
Glib::ustring get_codebox_plain(CtCodebox* codebox); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters