Center Current Line
Submitted by Thursday, 18 October, 2012 - 02:43
on
I needed a macro to center the current line. Here is my first stab at it. It works, but I am sure there is a lot that I am doing wrong. Is there another location in the forums to post macros?
Kevin
void centerCurrentLine(View view){
// need access to textArea.lastLinePartial
setAccessibility(true);
int cur_line = textArea.getCaretLine();
int lines_in_whole_page = textArea.getVisibleLines();
int lines_in_half_page = lines_in_whole_page / 2;
int new_first = cur_line - lines_in_half_page;
textArea.setFirstLine(new_first);
}
centerCurrentLine(view);
Kevin
void centerCurrentLine(View view){
// need access to textArea.lastLinePartial
setAccessibility(true);
int cur_line = textArea.getCaretLine();
int lines_in_whole_page = textArea.getVisibleLines();
int lines_in_half_page = lines_in_whole_page / 2;
int new_first = cur_line - lines_in_half_page;
textArea.setFirstLine(new_first);
}
centerCurrentLine(view);