Changeset 3320
- Timestamp:
- 03/13/09 07:52:44 (3 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Wx/Editor.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Editor.pm
r3313 r3320 843 843 } 844 844 845 846 # 847 # my ($begin, $end) = $self->current_paragraph; 848 # 849 # return $begin and $end position of current paragraph. 850 # 851 sub current_paragraph { 852 my ($editor) = @_; 853 854 my $curpos = $editor->GetCurrentPos; 855 my $lineno = $editor->LineFromPosition($curpos); 856 857 # check if we're in between paragraphs 858 return ($curpos, $curpos) if $editor->GetLine($lineno) =~ /^\s*$/; 859 860 # find the start of paragraph by searching backwards till we find a 861 # line with only whitespace in it. 862 my $para1 = $lineno; 863 while ( $para1 > 0 ) { 864 my $line = $editor->GetLine($para1); 865 last if $line =~ /^\s*$/; 866 $para1--; 867 } 868 869 # now, find the end of paragraph by searching forwards until we find 870 # only white space 871 my $lastline = $editor->GetLineCount; 872 my $para2 = $lineno; 873 while ( $para2 < $lastline ) { 874 $para2++; 875 my $line = $editor->GetLine($para2); 876 last if $line =~ /^\s*$/; 877 } 878 879 # return the position 880 my $begin = $editor->PositionFromLine($para1+1); 881 my $end = $editor->PositionFromLine($para2); 882 return ($begin, $end); 883 } 884 845 885 sub put_text_to_clipboard { 846 886 my ( $self, $text ) = @_;
Note: See TracChangeset
for help on using the changeset viewer.
