Skip to content

Commit cd7736c

Browse files
committed
---
yaml --- r: 6273 b: refs/heads/master c: a09dcd9 h: refs/heads/master i: 6271: ea279e1 v: v3
1 parent be24d00 commit cd7736c

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9ff6f816ba5e9a1a32fc7e15a5b30f5b057ed199
2+
refs/heads/master: a09dcd94c5809bd5cbedd5c06218e8db25c2881a

trunk/src/lib/rope.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,31 +1196,23 @@ mod node {
11961196
proportional to the height of the rope + the (bounded)
11971197
length of the largest leaf.
11981198
*/
1199-
fn char_at(node: @node, pos: uint) -> char {
1200-
let node = node;
1201-
let pos = pos;
1202-
while true {
1203-
alt(*node) {
1204-
leaf(x) {
1205-
ret str::char_at(*x.content, pos);
1206-
}
1207-
concat({left: left,
1208-
right: right,
1209-
char_len: _,
1210-
byte_len: _,
1211-
height: _}) {
1212-
let left_len = char_len(left);
1213-
if left_len > pos {
1214-
node = left;
1215-
} else {
1216-
node = right;
1217-
pos = pos - left_len;
1218-
}
1219-
}
1220-
}
1221-
};
1222-
fail;//unreachable
1223-
}
1199+
fn char_at(node: @node, pos: uint) -> char {
1200+
let node = node;
1201+
let pos = pos;
1202+
while true {
1203+
alt *node {
1204+
leaf(x) {
1205+
ret str::char_at(*x.content, pos);
1206+
}
1207+
concat({left, right, _}) {
1208+
let left_len = char_len(left);
1209+
node = if left_len > pos { left }
1210+
else { pos -= left_len; right };
1211+
}
1212+
}
1213+
}
1214+
fail;//unreachable
1215+
}
12241216

12251217
mod leaf_iterator {
12261218
type t = {

0 commit comments

Comments
 (0)