Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pdf_viewer/document_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,18 @@ void DocumentView::goto_mark(char symbol) {
}
}
}

void DocumentView::goto_beginning() {
if (current_document) {
goto_page(0);
}
}

void DocumentView::goto_end() {
if (current_document) {
int last_page_index = current_document->num_pages() - 1;
set_offset_y(current_document->get_accum_page_height(last_page_index) + current_document->get_page_height(last_page_index));
int last_page_index = current_document->num_pages()-1;
goto_page(last_page_index);
goto_bottom_of_page();
}
}

Expand Down
1 change: 1 addition & 0 deletions pdf_viewer/document_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class DocumentView {
NormalizedWindowPos window_to_normalized_window_pos(WindowPos window_pos);
void goto_mark(char symbol);
void goto_end();
void goto_beginning();

void goto_left();
void goto_left_smart();
Expand Down
9 changes: 5 additions & 4 deletions pdf_viewer/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,10 @@ class GotoBeginningCommand : public Command {
public:
void perform(MainWidget* main_widget) {
if (num_repeats) {
main_widget->main_document_view->goto_page(num_repeats - 1 + main_widget->main_document_view->get_page_offset());
main_widget->main_document_view->goto_page(num_repeats + main_widget->main_document_view->get_page_offset());
}
else {
main_widget->main_document_view->set_offset_y(0.0f);
main_widget->main_document_view->goto_beginning();
}
}

Expand All @@ -756,8 +756,10 @@ class GotoBeginningCommand : public Command {
class GotoEndCommand : public Command {
public:
void perform(MainWidget* main_widget) {
int num_pages = main_widget->main_document_view->get_document()->num_pages()-1;
if (num_repeats > 0) {
main_widget->main_document_view->goto_page(num_repeats - 1 + main_widget->main_document_view->get_page_offset());
main_widget->main_document_view->goto_page(num_pages - num_repeats);
main_widget->main_document_view->goto_bottom_of_page();
}
else {
main_widget->main_document_view->goto_end();
Expand Down Expand Up @@ -2310,7 +2312,6 @@ CommandManager::CommandManager(ConfigManager* config_manager) {
new_commands["focus_text"] = []() {return std::make_unique< FocusTextCommand>(); };
new_commands["goto_window"] = []() {return std::make_unique< GotoWindowCommand>(); };
new_commands["toggle_smooth_scroll_mode"] = []() {return std::make_unique< ToggleSmoothScrollModeCommand>(); };
new_commands["goto_begining"] = []() {return std::make_unique< GotoBeginningCommand>(); };
new_commands["toggle_scrollbar"] = []() {return std::make_unique< ToggleScrollbarCommand>(); };
new_commands["overview_to_portal"] = []() {return std::make_unique< OverviewToPortalCommand>(); };
new_commands["select_rect"] = []() {return std::make_unique< SelectRectCommand>(); };
Expand Down
2 changes: 1 addition & 1 deletion scripts/sioyek-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
script used to generate sioyek.py file
'''
sioyek_commands = {
"goto_begining": [False, False, False, True],
"goto_beginning": [False, False, False, True],
"goto_end": [False, False, False, True],
"goto_definition": [False, False, False, False],
"overview_definition": [False, False, False, False],
Expand Down
4 changes: 2 additions & 2 deletions scripts/sioyek.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def run_command(self, command_name, text=None, focus=False):
else:
subprocess.run(params)

def goto_begining(self, focus=False):
def goto_beginning(self, focus=False):
data = None
self.run_command("goto_begining", data, focus=focus)
self.run_command("goto_beginning", data, focus=focus)

def goto_end(self, focus=False):
data = None
Expand Down
4 changes: 2 additions & 2 deletions scripts/summary_highlight_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def decode(outputs_ids):

def roll_encoding(encoding):
# by default if encodings are smaller than maximum length, they are padded with
# zeroes at the end. We need the zero padding to be at the begining for next
# zeroes at the end. We need the zero padding to be at the beginning for next
# character prediction to work
new_encoding = torch.clone(encoding)
num_rows = encoding.shape[0]
Expand Down Expand Up @@ -163,4 +163,4 @@ def handle_text_mask():

return jsonify({'text': refined_imask, 'page': page})

app.run()
app.run()