| 1 |
/* vim: set encoding=utf8: |
| 2 |
* |
| 3 |
* buffer.c |
| 4 |
* |
| 5 |
* This file is part of Shiki. |
| 6 |
* |
| 7 |
* Copyright(C)2006 WAKATSUKI toshihiro |
| 8 |
* |
| 9 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 10 |
* copy of this software and associated documentation files (the "Software"), |
| 11 |
* to deal in the Software without restriction, including without limitation |
| 12 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 13 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 14 |
* Software is furnished to do so, subject to the following conditions: |
| 15 |
* |
| 16 |
* The above copyright notice and this permission notice shall be included in |
| 17 |
* all copies or substantial portions of the Software. |
| 18 |
* |
| 19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 24 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 25 |
* SOFTWARE. |
| 26 |
* |
| 27 |
* $Id: buffer.c,v 1.2 2006/11/24 19:34:48 aloha Exp $ |
| 28 |
*/ |
| 29 |
#include"shiki.h" |
| 30 |
|
| 31 |
gchar *Shiki_buffer_substring(gint start, gint end) { |
| 32 |
if(start >= end) |
| 33 |
return NULL; |
| 34 |
else { |
| 35 |
GtkTextIter s, e; |
| 36 |
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &s, start); |
| 37 |
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &e, end); |
| 38 |
|
| 39 |
return gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &s, &e, FALSE); |
| 40 |
} |
| 41 |
} |